C#生成的Outlook电子邮件中的新行/回车符

时间:2013-10-29 14:50:20

标签: c# outlook newline

也许outlook只是将它格式化为Outlook希望它看起来的方式,bc代码对我来说很好,也许你们中的一个大师可以告诉我如何添加回车(让下一个上一个雇主出现在下一行)

Outlook.Application oApp = new Outlook.Application();
Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem         
(Outlook.OlItemType.olMailItem);                
string content = string.Empty;
string content = previousEmployer + Environment.NewLine;
//I have also tried this to no avail
//string content = previousEmployer + "\n";
oMsg.HTMLBody = content;
Outlook.Recipients oRecips = (Outlook.Recipients)oMsg.Recipients;
Outlook.Recipient oRecip = (Outlook.Recipient)oRecips.Add("alphaomegaentry.com");
oRecip.Resolve();
oMsg.Save();
oRecip = null;
oRecips = null;
oMsg = null;
oApp = null;

1 个答案:

答案 0 :(得分:4)

如果 HTMLBody 确实需要包含HTML,您可以尝试这样做:

string content = string.Format("{0}<br />", previousEmployer);
oMsg.HTMLBody = content;