New line not working in email
I have used the following code in many programs, but in this one program the newline does not work when sent my email, but works when written to a file. Why does it not work in this one program?
I hid the email addresses & relay. Thanks, arep
string newline = "\r\n";
string message1 = "Success - Weekly " + name + " Claims Extract Succeeded";
string message2 = name + " Extract Succeeded" + newline + "Start Time: " + stime
+ newline + "Finish Time: " + etime
+ newline + "Run Time: " + span.ToString("c")
+ newline + "Record Count: " + recnt.ToString()
+ newline + "************************************************************************";
Output_Files.PrintLog(message1);
Output_Files.PrintLog(message2);
SendEmail(message1, message2);
public static void SendEmail(string subject, string body)
{
// create mail message object
MailMessage mail = new MailMessage();
MailAddress maddr = new MailAddress("emailaddress");
mail.From = maddr; // put the from address here
mail.To.Add("emailaddress"); // put to address here
mail.Subject = subject; // put subject here
mail.Body = body; // put body of email here
SmtpClient smtpMail = new SmtpClient("smtprelay"); // put smtp server you will use here
// and then send the mail
smtpMail.Send(mail);
}