How to write the messages in the Email with two line spacess for each Message
message.Body = "Message: " + ex.Message +Environment.NewLine + "Data:"+ ex.Data
+ Environment.NewLine + "S开发者_运维知识库tack Trace:" + ex.StackTrace;
I am using Environment.NewLine., its going to next line perfectly but I need to put two line separated with ---------------- in between each message Data StackTrace.
Instead of Environment.NewLine, put:
"\n\r----------------\n\r"
You can store this in a const and then reuse:
const string Sep = "\n\r----------------\n\r";
message.Body = "Message: " + ex.Message + Sep + "Data:" + ex.Data
+ Sep + "Stack Trace:" + ex.StackTrace;
NB: \n\r produces a new line and a carriage return.
To reuse the code in a confirmation page, for example, replace the "\n\r" with
"<br />"
u can try "<br/> ------------------"
u can write html tags in message body but not in the title
精彩评论