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
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