MailMessage sent string as body without newline in outlook

前端 未结 10 871
挽巷
挽巷 2020-12-11 15:44

HI, I am trying to send a simple notification using system.net.mail.mailmessage. I just pass the string as the message body. But problem is even though multi-line message be

10条回答
  •  甜味超标
    2020-12-11 16:27

    Outlook will always remove line breaks, however, what can be used is the following:

    In stead of using: Environment.Newline or \n\r

    You should use string MyString += "this is my text" + "%0d%0A"

    This %0d%0A will be recognised by outlook as the escape sequence for a new line.

提交回复
热议问题