mime 格式的文件在出现换行符时会丢失点
我正在编写一个包含 html 的 mime 格式的电子邮件文件。我正在编写 mime 文件的 html 部分,如下所示:
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));
在 HTMLBody 中,我有一大块 html。其中一个片段如下所示:
<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 />
请注意 //xxxxxshow.xxxpoint.com 域,它跨越 mime 文件中的换行符。当此域到达 Outlook 时,它“丢失了第一个点”,因此它读取的是 xxxxshowxxxpoint.com,而它应该读取的是 xxxxxshow.xxxpoint.com。如果发生换行,使得该点成为下一行的第一个字符,则该点会“丢失”,并且当电子邮件到达 Outlook 时,该点会从电子邮件源中丢失。如果换行符出现在“xxxxxshow”一词的中间,则该点不会丢失,并且它确实会出现在 Outlook 内的电子邮件中。
这是怎么回事?我该如何解决这个问题?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这看起来您没有正确编码 SMTP 的电子邮件文本。 来自维基百科:
基本上,每当您想在行首写一个句点时,您都必须写两个句点。
This looks like you're not encoding the text of the e-mail for SMTP correctly. From Wikipedia:
Basically, whenever you want to write a period at the start of a line, you have to write two periods instead.