开发者

Web Mail client helper not translating newlines in body of msg (mvc3/asp.net)?

开发者 https://www.devze.com 2023-04-13 06:45 出处:网络
开发者_如何转开发Can somebody tell me why newlines are not being translated in the email message when passed in as the body of the web mail helper?

开发者_如何转开发Can somebody tell me why newlines are not being translated in the email message when passed in as the body of the web mail helper?

            string body = "First line here" +  Environment.NewLine + Environment.NewLine +
          "Here is a newline...";

                    WebMail.Send(
                        "myemail@mycom.com",
                        "Subject",
                        body, "myemail@mycom.com");

Output is all on the same line in the email message itself. Thx!


Default value for parameter isBodyHtml from send method is true that's why Environment.NewLine is ignored. If you'll set isBodyHtml = false it will work.

WebMail.Send(to: "mail@gmail.com", subject: "Test", isBodyHtml:false, body: "First line here" + Environment.NewLine + "Second line.");
0

精彩评论

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

关注公众号