Blog Stats
  • Posts - 14
  • Articles - 0
  • Comments - 14
  • Trackbacks - 0

 

Monday, September 14, 2009

Line Feed in HTML Mail to avoid Line Too long error

Most of the times 'SMTP proxy service on Firewall ' would not allow a line longer  than '999' characters in HTML email. The solution would be to put a line feed in the HTML string of the mail 900 characters.

If you put this Line feed into the HTML string, it might break the formating.  The right approach will be to put linefeed in the text fields ( e.g. Comments / Description) at appropriate position.

 

I ended up putting linefeed every 200 characters:

 int j = TextColumn.Length/200;
for(int i=1;i<=j;i++)
{
          TextColumn = TextColumn.Insert(i * 200,Environment.NewLine);
}

 

 

 

 

 

 

 

Copyright © faizanahmad