开发者

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

开发者_如何转开发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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜