开发者

MailMessage ignoring my line breaks

开发者 https://www.devze.com 2023-02-18 23:42 出处:网络
I am invoking the following code: public static void SendMessage(string sender, string recipient,string subject,string body)

I am invoking the following code:

public static void SendMessage(string sender, string recipient,string subject,string body)
{
    var message = new MailMessage(sender, recipient, subject, body);
开发者_如何学Python    _smtpClient.Send(message);
}

There are line breaks a.k.a. Environment.NewLine in the body of the message, but when I open the message in Outlook, they are not there. What am I missing?


Do you see the "Extra line breaks in this message were removed." message underneath the sender's address in message window?

If so, click the "Extra line breaks" message and select "Restore line breaks."

0

精彩评论

暂无评论...
验证码 换一张
取 消