I am very very new to Csharp. I am editing a file parsing application a coworker wrote before he left. I am trying to send an HTML formatted email that's supposed to alert users when the app runs into an exception:
catch (Exception ex)
{
Logger.Error(ex.Message); //63-116
string fromemail = "sampleem@samp.com";
string toemail = "sampleem@samp.com";
string subject = "Automated From Repair Cruncher";
string team = "Data Engineering Team";
string body = "The following error occured in Client.Handler.EntityHandler.cs while Parser was processing:\n";
body += ex.Message;
var result = EmailUtil.Emailalert(fromemail, toemail, subject, team, body);
}
However, when I get the email, there is no newline between the processing and the ex.message. It does it on the same line. Why is this? I also tried \n but it didn't give me newline either
I have tried Environment.Newline but it doesn't work either
` or `
`
– superstator Nov 19 '20 at 03:47. – Jerry Nov 19 '20 at 03:53
`. – mjwills Nov 19 '20 at 03:56
. The python logic would print things exactly as I formatted the string in Python with no HTML tags. The HTML tags only came into play with making tables. Not pure strings. Interesting to see the difference. I have A LOT to learn about .net – edo101 Nov 19 '20 at 03:59