smtp.body length issue

ace333

Newcomer
Joined
Jul 19, 2005
Messages
22
MailMessage mail = new MailMessage();

mail.To = xxx@xxx.com;

mail.From = xxx@xxx.com;

mail.Subject = "xxx 10/10/2005";

mail.BodyFormat = MailFormat.Html;

mail.Body ="large amount of html approximately 1080 rows of a table";

SmtpMail.SmtpServer = "xxx";

SmtpMail.Send(mail);

Is there a limit to the amount of data that can be send using the c# mail methods...
I am trying to send 1078 rows of data through but the html I get out from the email is slightly deformed, i.e.
! are inserted between some of the </!td> tags.....
If I limit it to 140 rows or less things are fine......

Is there a max number of data that can be sent at a time..... Obviously I could send more that one email,
but would prefer not to do that
 
Not sure of any restrictions on mail sizes under C# - however a lot of mail servers themselves will impose a size restrictions. however that shouldn't cause your message body to be modified, could you post an example of the HTML you are using and the code that is generating the HTML.
 
here is the code sample

int i =0;
while (myDataReader.Read()/*&&(i<120)*/)
{
CommentId = myDataReader["CommentId"].ToString();
Comments = myDataReader["Comments"].ToString().Replace("<","<");
Comments = Comments.Replace(">",">");
//Comments = Comments.Replace("&","&");
//Comments = Comments.Replace("€","€");
//Comments = Comments.Replace("\"",""");
//Comments = Comments.Replace("'","'");


UserId = myDataReader["UserId"].ToString();
RiskId_ExternalId = myDataReader["RiskId\\ExternalId"].ToString();


i++;
table=table+"<tr><td> "+myDataReader["CommentId"]+"</td><td> "+myDataReader["DacType"]+"</td><td> "+myDataReader["SheetId"]+"</td><td> "+Comments+"</td><td> "+myDataReader["TypeOfComment"]+"</td><td> "+RiskId_ExternalId+"</td><td> "+UserId+"</td><td> "+myDataReader["FullName"]+"</td><td> "+myDataReader["AmendedDateTime"]+"</td></tr>";
}
table = "<html><head><title>Test</title></head><body><table border='1'>"+"<tr><td><b>CommentId</b></td><td><b> DacType</b></td><td><b>SheetId</b></td><td><b>Comments</b></td><td><b>TypeOfComment</b></td><td><b>RiskId\\ExternalId</b></td><td><b>UserId</b></td><td><b>FullName</b></td><td><b>AmendedDateTime</b></td></tr>"+table+"</table></body></html>";

TextWriter xmlContent = new StreamWriter(@"C:\Temp\xmlContent.txt");



I have written the output to a file before and after its sent through the email server and after it comes out ! are found between the <!/td> closing tags


<html><head><title>Test</title></head><body><table border='1'><tr><td><b>CommentId</b></td><td><b> DacType</b></td><td><b>SheetId</b></td><td><b>Comments</b></td><td><b>TypeOfComment</b></td><td><b>RiskId\ExternalId</b></td><td><b>UserId</b></td><td><b>FullName</b></td><td><b>AmendedDateTime</b></td></tr><tr><td> 1</td><td> CAP</td><td> 107</td><td> As per L Dudley s request</td><td> RejectedComment</td><td> 78009685</td><td> lcross3</td><td> LISA CROSS</td><td> 18/08/2005 17:07:44</td></tr><tr><td> 1</td><td> CAP</td><td> 107</td><td> Payment attached to option. Option cpty changed to ISS/CRESGB2L from BOC. As payment is attached it s now showing in Payment tracker. Pls reverse. any questions plc call me. Thxs x37608</td><td> Comment</td><td> 78009685</td><td> lcross3</td><td> LISA CROSS</td><td> 18/08/2005 17:07:44</td></tr><tr><td> 1</td><td> CAP</td><td> 430</td><t!
d> As per L Dudley ..... snippet of the code ..........
 
Back
Top