Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Mail message size problem (System.Web.Mail)

Thread Tools

Mail message size problem (System.Web.Mail)

Posts: n/a
I have a simple .Net console program that sends an email message. The
message can be specified as a string or a filename on the command line.
Refer to the code below.

The problem I am having is that it works fine on one computer (my
workstation) for messages of any size but it fails on another computer (my
test server) for messages larger than 900 bytes. Both systems are running
Windows 2003 Server - Standard Edition. My workstation is on a domain and
has Outlook installed. The test server is not on a domain and does not have
Outllook installed. The test involves sending directly to an external SMTP
server; I don't use the localhost for relaying.

The program will actually send messages from the test server if the body is
less than 900 bytes, however when i try to send a larger message, 1200 bytes,
it fails with the error:

Could not access 'CDO.Message' object.

Exception has been thrown by the target of an invocation.
The transport lost its connection to the server.

Does anyone have an idea about why there is a size limitation on one system
but no limitation on the other?


static public bool SendMessage(string strSubject, string strMsg,
string strFrom, string strTo, string strServer)
string strMsgBody = "";

if (strMsg.StartsWith("@"))
StreamReader rdr = new StreamReader(strMsg.Substring(1));
string sLine = rdr.ReadLine();
while (sLine != null)
strMsgBody += sLine + "\n";
sLine = rdr.ReadLine();

strMsgBody = strMsg;

System.Web.Mail.SmtpMail.SmtpServer = strServer;
System.Web.Mail.MailMessage msg = new System.Web.Mail.MailMessage();

msg.From = strFrom;
msg.Subject = strSubject;
msg.Body = strMsgBody;
msg.BodyEncoding = System.Text.Encoding.ASCII;
msg.BodyFormat = MailFormat.Text;
msg.To = strTo;

catch (Exception ex)
return false;

return true;

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Preferred Size, Minimum Size, Size Jason Cavett Java 5 05-25-2008 08:32 AM
mega pixels, file size, image size, and print size - Adobe Evangelists Frank ess Digital Photography 0 11-14-2006 05:08 PM
System.Web.Mail.MailMessage - message size =?Utf-8?B?Qm9i?= ASP .Net 0 09-27-2005 06:41 PM
Thunderbird - message exceeds the Maximum Message Size? Gerry Firefox 0 02-18-2005 06:39 PM
Size of e-mail message - message.Body = msgText =?Utf-8?B?bWc=?= ASP .Net 1 02-11-2004 07:42 PM