I am writing a mime-formatted email message file containing html. I am writing the html portion of the mime file as follows:
writer.WriteLine("--" + altBoundary);
writer.WriteLine("Content-Type: text/html; charset=\"UTF-8\"");
writer.WriteLine("Content-Transfer-Encoding: quoted-printable");
writer.WriteLine();
QuotedPrintableEncoder qpEncoder=new QuotedPrintableEncoder();
writer.WriteLine(qpEncoder.Encode(HTMLBody));
In the HTMLBody I have a large chunk of html. One fragment of this looks as follows:
<p><br />Dear Ben,<br /><br />
Thank you for your interest in our products and services.
=
=20
</p>
<p>Here are some literature links you may find interesting:<=
/p>
<ul><li><a title=3D"Brochure One" href=3D"http://xxxxxshow=
.xxxpoint.com/Document?client=3DXxxxxxpoint&document=3DBrochure One">Broch=
ure One</a></li></ul>
Regards,<br />
Note the //xxxxxshow.xxxpoint.com domain, which spans a line break in the mime file. When this domain arrives in Outlook it has 'lost the first dot, so it reads xxxxshowxxxpoint.com, whereas it should read xxxxxshow.xxxpoint.com. If a line break occurs so that the dot is the very first character on the next line, the dot gets 'lost', and is missing from the source of the email when it arrives in Outlook. If the line break occurs half-way through the word 'xxxxxshow' then the dot does not get lost, and it does appear in email within outlook.
What is going on, and how do I fix this?
This looks like you're not encoding the text of the e-mail for SMTP correctly. From Wikipedia:
Since a message body can contain a line with just a period as part of the text, the client sends two periods every time a line starts with a period; correspondingly, the server replaces every sequence of two periods at the beginning of a line with a single one. Such escaping method is called dot-stuffing.
Basically, whenever you want to write a period at the start of a line, you have to write two periods instead.