Help! Sending Emails From asp.net Application

J

Joey

I am currently developing a C# asp.net application where users are
required to register. The application then generates a simple, plain
text email and sends it to the new user.

I have been trying to use the MailMessage and SmtpMail classes from the
System.Web.Mail namespace (built in to .net) to do this. It is my
understanding that these classes use CDONTS (cdosys.dll) and the SMTP
mail service on the server to send the messages. Messages are generated
and then placed in the "Queued" folder under the SMTPRoot folder in
IIS. The SMTP server service does the rest...

The problem I am having is that this method appears to be extremely
unreliable, at best. Sometimes the message will send, and sometimes I
get a "could not access CDO.Message" exception/error. After searching
for this on usenet, I have also discovered that this problem appears to
be very common. The only solution I can find is to reboot the
service/server (and that doesn't always work!)

Anyways, this is clearly not going to work in a production environment,
so I need to do something about it.

I would like to know if anyone has any suggestions on what I might do
to improve performance and reliability when trying to send emails from
my asp.net application. Are there better options to use for this (i.e.
3rd party components or tools?) If so, what would you recommend, and
why?

Thanks in advance for your help!
 
B

Ben Amada

Joey said:
The problem I am having is that this method appears to be extremely
unreliable, at best. Sometimes the message will send, and sometimes I
get a "could not access CDO.Message" exception/error. After searching
for this on usenet, I have also discovered that this problem appears to
be very common. The only solution I can find is to reboot the
service/server (and that doesn't always work!)

Anyways, this is clearly not going to work in a production environment,
so I need to do something about it.

I would like to know if anyone has any suggestions on what I might do
to improve performance and reliability when trying to send emails from
my asp.net application. Are there better options to use for this (i.e.
3rd party components or tools?) If so, what would you recommend, and
why?

Thanks in advance for your help!

I've heard good things about aspNetEmail (haven't tried it myself though):

http://www.aspnetemail.com/

Good luck,
Ben
 
J

Juan T. Llibre

Hi, Joey.

The biggest problem I've seen when using an smtp server to send emails
is that the connection limit is easily surpassed because the system can
create emails faster than they can be sent out.

That causes a bit of unreliability and choking.

I've seen good results, and almost perfect reliability, when a little
delay is introduced to allow the number of connections to be lowered.

This little piece of code might be of help ::

if( connectionLimit != -1
&& ++sentCount >= connectionLimit ) {

System.Threading.Thread.Sleep( new TimeSpan( 0, 0, 0, 15, 0 ) );

sentCount = 0;
}

re:
It is my understanding that these classes use CDONTS (cdosys.dll)
and the SMTP mail service on the server to send the messages.

Windows Server 2003 does not install Collaboration Data Objects (CDO)
for NTS (CDONTS). Therefore, applications that use CDONTS do not
function on a Windows Server 2003-based computer.

Actually, the System.Web.Mail namespace provides a managed wrapper
for CDOSYS. The System.Web.Mail namespace is only available in
..NET Framework applications.

re:
"could not access CDO.Message"

What is your OS ?
 

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

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top