Resolved Problems sending html email via MailMessage

thebard

New member
Joined
Jun 23, 2010
Messages
3
Programming Experience
3-5
Hi all,

Been struggling with this problem for a few days, will really like some help on it.

I'm building a desktop app to send html emails with MailMessage. Checked the input and all, everything is fine, till it sends out the email. Somehow, all the equal signs in the email have '3D' attached, causing the html to fail (i.e. '=' becomes '=3D')

Anyway to stop vb.net from adding additional characters to the email?
 
Last edited:
Welcome to the forum,

Unfortunately without you supplying the code you're using it will be difficult for anyone to identify what may be causing the problem.
One thing that I can recommend is that you have a look at the following article, which provides a pre-made class for sending emails that may avoid the problem.
Sending an email from a .Net application - VB.Net Articles - SatalKeto.co.uk

Hope this helps

Satal :D
 
Thank you for welcoming me :),

I tried your class but I'm still having the same problem.

How I'm calling it
VB.NET:
Dim objEMail As New Email.Email(strHost,strUser,strPassword)
objEMail.SMTPPort = intPort
		
objEMail.Tos.Add(strTo)
objEMail.subject = strSubject
objEMail.HTMLEmail = True
objEMail.message = strBody
msgbox(objEMail.sendEmail())

strBody before it's sent out
VB.NET:
<A href="test.html">Insert your email here</A>

the email I got
VB.NET:
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: quoted-printable

<A href=3D"test.html">Insert your email here</A>

The problem is the '3D' appended after the equal sign in the email. Some email clients (like Thunderbird) cannot recognize it as html and gives me flat text instead.
 
@thebard

Just to keep you informed I have been able to reproduce the problem that you are having and I am investigating it :)

UPDATE:
After looking into this further it seems that the email is encoded and =3D is the value for =.
One way you might be able to get around this is by adding the following code to your email code (I will be updating my email class shortly after reposting this)
VB.NET:
mail.BodyEncoding = System.Text.Encoding.UTF8

I have tested this and it works on the latest version of Thunderbird, Microsoft Outlook 2010 (BETA) and Gmail.
 
Last edited:
@Satal Keto

I found another piece to the problem, all the links without 'http://' at the in front doesn't show up as hyperlink in some clients with MS's encoding (some encoding from other platform seem to work though). Will have to add a strict url verification to my app.

Thanks for all the help Satai!
 
This sounds more like a content encoding problem.. In some content encoding styles, lines are fixed at e.g 80 characters and to signify that the line continues without a break, an = is added to the end of the line. Naturally thus the equals sign proper (character code 0x3D) has to be escaped. It could also be a problem with the way URLs are being encoded in the body text or decoded by the client

VB.NET:
This is=
an exam=
ple of =
a mail =
with se=
ven cha=
racters=
per lin=
e=
An equa=
ls symb=
in the =
body mu=
st be e=
ncoded =
as =3D =
 
Back
Top