我正在使用dotnet框架发送电子邮件。这是我用来创建消息的模板:
Date of Hire: %HireDate%
Annual Salary: %AnnualIncome%
Reason for Request: %ReasonForRequest%
Name of Voluntary Employee: %FirstName% %LastName%
Total Coverage Applied For: %EECoverageAmount%
Guaranteed Coverage Portion: %GICoveragePortion%
Amount Subject to Medical Evident: %GIOverage%
在Outlook中收到消息后,Outlook会告诉我“该消息中的多余换行符已被删除”。消息显示如下:
Date of Hire: 9/28/2001
Annual Salary: $100,000
Reason for Request: New Hire
Name of Voluntary Employee: Ronald Weasley Total Coverage Applied For: $500,000 Guaranteed Coverage Portion: $300,000.00 Amount Subject to Medical Evident: $200,000
请注意Outlook如何在名称,EECoverageAmount等后面错误地删除所需的换行符...
对于电子邮件接收者而言,获取正确格式的电子邮件非常重要,我必须假设其中一些使用Outlook2003。我也不能假设他们会足够了解自动清除功能以使消息正确格式化。
我已经在其他邮件客户端中查看了这些消息,它们显示正确
一些更多的信息:
- 我正在使用UTF-8 BodyEncoding(msg.BodyEncoding = System.Text.Encoding.UTF8)
- 从UTF-8编码的文本文件中读取msg.Body,并且每行以crlf结尾。
问题:如何更改消息格式以避免此问题?
\r\n
。它为我工作。