473,386 Members | 2,078 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Mail message size problem (System.Web.Mail)

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?
=====================================
THE CODE:

static public bool SendMessage(string strSubject, string strMsg,
string strFrom, string strTo, string strServer)
{
try
{
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();
}

rdr.Close();
}
else
{
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;

System.Web.Mail.SmtpMail.Send(msg);
}
catch (Exception ex)
{
DumpException(ex);
return false;
}

return true;
}

Nov 22 '05 #1
0 1365

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: MrFez | last post by:
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...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
2
by: Rene | last post by:
Hi all i need some help. i try to send mail with the following code. Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click Dim...
4
by: Jim in Arizona | last post by:
Now that I've figured out how to send mail within our domain: Dim test as new System.Net.Mail.SmtpClient Dim nco as New System.Net.NetworkCredential("mailaccount","password","domain")...
34
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow...
0
by: jlconde | last post by:
I have a classe to send mails. It runs on yahoo well but with hotmail I never receive the mails.I do not receive an error neither. I would need some strange header to make the hotmail like my...
4
by: Alec MacLean | last post by:
Is anyone aware of a size limit imposed on the subject text when using the System.Net.Mail library? I'm getting problems of message not being recieved if the subject exceeds 15 chars. Thx
2
by: satnamsarai | last post by:
Using System.Net.Mail: Sometimes I get error 'failure sending mail. Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.' Not sure how...
1
by: WIzmanG | last post by:
Hi all I am having trouble with sending email via a C#2.0 application, I use the same settings as I use in Outlook but I cannot get email to send. I am trying to use SSL on port 465 and get the...
3
by: raj200809 | last post by:
when i m sending mail i received error from symantec Antivirus" Your email message was unable to be sent because your mail server rejected the message 550-5.7.1 the ip you’re using to send mail is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.