MailMessage-Object error - net 1.1 , VS 2003

R

Rolf Welskes

Hello,
I have a simple program which sends emails.
The main function is:

private bool InitAndSendEmail(string mailTo, string subject, string txt,
string mailFrom)
{

MailMessage myMail = new MailMessage();

try
{
myMail.From = mailFrom;
myMail.To = mailTo;
myMail.Subject = subject;
myMail.Body = txt;

string smtpServer = "mail.kybtec.de";
string userName = myMail.From;
string password = "12345678";
int cdoBasic = 1;
int cdoSendUsingPort = 2;
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver",
smtpServer);
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport",
25) ;
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing",
cdoSendUsingPort) ;
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
cdoBasic);
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
userName);
myMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
password);

myMail.BodyEncoding = Encoding.UTF8;
myMail.BodyFormat = MailFormat.Html;

SmtpMail.SmtpServer = smtpServer;

SmtpMail.Send(myMail);


myMail = null;

return true;
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);

return false;
}
}
This works fine if I only send for example 10 emails.
If I send for example (loop based) 300 emails the following happens.
The first 100 emails are sent.
Now I get the exception. 'Could not access CDO.Message object'.
This is not a problem of the email server. Because:
If I wait for example 1 hour, I can again send 100 or so emails then the
error.
Or I can boot the computer, then I can send 100 or so emails and then the
error again.

Seems that there is something locked after a number of emails on the
computer.

Thank you for any help.

Rolf Welskes
 
S

Steven Cheng[MSFT]

Hi Rolf,

From your description, you're using the System.Web.Mail smtp component to
send email in your .net 1.1 application, however, you found that it will
report "Could not access CDO.Message object" error after sending 100
mailmessages, correct?

According to this error message, I've performed some research, it seems
this exception message is quite general (may be raised by different kind of
underlying errors). Would you paste the full exception callstack (may also
include the innerException information) here so that we can have a further
look. Here is a FAQ article on systemwebmail site which discussing on this
general error message:

http://www.systemwebmail.com/faq/4.2.3.aspx

So far my opinion is that the problem should be a particular case and
sending 100 mailmessages should not be a common problem.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.
 
R

Rolf Welskes

Hello,
thank you,
here the information:

stacktrace:

at System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String
methodName, Object[] args)
at System.Web.Mail.CdoSysHelper.Send(MailMessage message)
at System.Web.Mail.SmtpMail.Send(MailMessage message)
at EmailSys01.EmailerForm.InitAndSendEmail(String mailTo, String subject,
String txt, String mailFrom) in
f:\wb\shopcontroler\shopcontrolersl01\emailsys01\emailerform.cs:line 348

innerexception:
Exception has been thrown by the target of an invocation.

Remark: If this error in the application occurs and I use frontpage express
to send a single email from the same emailaddress,
also frontpage express shows an error, that the underliing server had broken
the connection, what is impossible.

Again: one hour later or after a reboot of the system all works fine for the
next 100 emails.

Thank you for any help.
Rolf Welskes
 
S

Steven Cheng[MSFT]

Thanks for your reply Rolf,

Then, from your further description, when the error occur, other mail
client also can not send any messages through that mail server(with same
source address), correct? I think it is possible that the SMTP server has
some configuration that limit the number of concurrent requests from the
same client, something like Dos attach protection. You can contact the
server admin if possible to confirm this or test via using some other SMTP
server(exchange) server to see whether the same behavior occur.

In addition, you can also use some network trace utility such as netmon or
ethereal to capture the SMTP requests, if the network packets send before
error occur, or after error occur are identical, that means the client
application should work correctly.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top