0

We're running an older ASP.NET 2.5 application and we use the System.Net.Mail namespace to send plaintext emails to customers. Some are a bit long because we send lists of products that are being changed to our clients.

We're getting reports from our users that their emails are cutting off. After some investigation we realized that they're only cut off in Outlook. In Gmail they're fine. Any idea what this could be?

Here is a stripped out sample of the code generating our emails...

MailMessage msg = new MailMessage();
SmtpClient client = new SmtpClient(ConfigurationManager.AppSettings["smtpHost"], Convert.ToInt16(ConfigurationManager.AppSettings["smtpPort"]));
client.Credentials = new    NetworkCredential(ConfigurationManager.AppSettings["smtpCredentialUser"], ConfigurationManager.AppSettings["smtpCredentialPassword"]);

msg.From = new MailAddress("xxx@xxxx.xxx", "Product Alert");
string Message_Subject = "Product Alerts";

string body = "\nThe following Products have been updated" + "\r\n\r\n";
    foreach (ProductItem pi in prods.updatedItems)
    {
        body += "Product Name: " + pi.Name.ToString() + "\n";
        body += "New Price   : " + pi.Price.ToString() + "\n";
    }

msg.Body = body;
msg.To.Add(new MailAddress("xxx@xxx.xxx","Mr. Test");

client.Send(msg);
Larry Grady
  • 469
  • 7
  • 24
  • This might be 100% unrelated but the first thing that I would try would be to change the encoding of your message to UTF8, [see this answer](http://stackoverflow.com/a/6603002/231316) for how – Chris Haas Oct 26 '15 at 17:31

1 Answers1

0

The problem may be related to some "special-code" character inside your text, causing Outlook to understand EOF or something like that.

Try to specify the BODYFORMAT as PLAINTEXT.

      msg.bodyformat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatPlain
David BS
  • 1,822
  • 1
  • 19
  • 35
  • The version of .Mail i'm using doesn't have a .bodyformat property. IT does have .IsBodyHtml and .BodyEncoding. I'm going to play with them and see what works. Will try UTF8 in there as suggested above. – Larry Grady Oct 27 '15 at 15:33
  • So, set only .IsBodyHTML = false, since your message is plaintext. – David BS Oct 27 '15 at 15:57