ALFitness recently wanted to change their users’ email marketing tool and decided to use aweber. This looked like it would be a simple process but ended up being a nightmare.
When a user joined ALFitness we would subscribe them to an email list in aweber by sending an email. This was not a problem. The problems started when we wanted to parse information from that email so it could be used in the marketing campaign.
i.e. Saving current exercise frequency and activities they enjoyed.
We would receive an email from MAILER-DAEMON@mail1.aweber.com saying:
Hi. This is the qmail-send program at mail1.aweber.com. I’m afraid I wasn’t able to deliver your message to the following addresses. This is a permanent error; I’ve given up. Sorry it didn’t work out.
It would then attach a copy of our email with the body formatted strangly:
Exercise Regularity: 1-3 times per week=0D=0AActivities Enjoyed: Home gym=0D=0A
The problem is instead of Carriage Return Line Feeds it was receiving =0D=0A. After a lot of time on the phone with Aweber and a lot of searching I found out that we were sending our emails with: Content-Transfer-Encoding: quoted-printable. Apparantly there are some systems that cannot recognize this and we would need to change this to 7bit. It isn’t obvious how to do this but this is how we achieved it:
Dim message As MailMessage = New MailMessage message.From = New MailAddress(from) message.To.Add(pTo) message.Subject = subject message.BodyEncoding = Encoding.GetEncoding("iso-8859-1") Dim plainView As AlternateView = AlternateView.CreateAlternateViewFromString(body, Encoding.GetEncoding("iso-8859-1"), "text/plain") plainView.TransferEncoding = Net.Mime.TransferEncoding.SevenBit 'VERY IMPORTANT message.AlternateViews.Add(plainView) Dim smtpClient As SmtpClient = New SmtpClient smtpClient.Send(message)