PC Review

Thread Tools Rate Thread

Mail message size problem (System.Web.Mail)

Posts: n/a
      14th Mar 2005
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
Rate This Thread
Rate This Thread:

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
554 5.3.4 Message size exceeds fixed maximum message size rdd123 Microsoft Outlook Discussion 2 23rd Feb 2009 09:01 PM
Mail message size problem (System.Web.Mail) =?Utf-8?B?TXJGZXo=?= Microsoft Dot NET Framework 0 14th Mar 2005 06:23 PM
Mail message size problem (System.Web.Mail) =?Utf-8?B?TXJGZXo=?= Microsoft Dot NET 0 14th Mar 2005 06:15 PM
opening mail message min size want full size blondpolack Microsoft Outlook Discussion 0 16th Aug 2003 12:16 AM
Re: windo xp screen size played a game in full screen size now i cant get my size ba Jimmy S. Windows XP Games 1 1st Aug 2003 10:55 AM




All times are GMT +1. The time now is 01:16 AM.