Help! Sending Emails From asp.net Application

Discussion in 'ASP .Net' started by Joey, Jul 27, 2005.

  1. Joey

    Joey Guest

    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!
    Joey, Jul 27, 2005
    #1
    1. Advertising

  2. Joey

    Ben Amada Guest

    Joey wrote:

    > 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
    Ben Amada, Jul 27, 2005
    #2
    1. Advertising

  3. 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 ?




    Juan T. Llibre
    ASP.NET MVP
    http://asp.net.do/foros/
    Foros de ASP.NET en EspaƱol
    Ven, y hablemos de ASP.NET...
    ======================

    "Joey" <> wrote in message
    news:...
    >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!
    >
    Juan T. Llibre, Jul 27, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mark

    Sending emails through Asp.net

    mark, Nov 21, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    401
    Thomas R
    Nov 21, 2003
  2. Patrick Santry

    Re: Re: Sending emails through Asp.net

    Patrick Santry, Nov 21, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    720
    Thomas R
    Nov 21, 2003
  3. TomS
    Replies:
    0
    Views:
    377
  4. Ryan
    Replies:
    0
    Views:
    392
  5. =?Utf-8?B?QnJpYW4gTQ==?=

    ASP.NET not sending SMTP emails on Windows 2003

    =?Utf-8?B?QnJpYW4gTQ==?=, Nov 16, 2004, in forum: ASP .Net
    Replies:
    6
    Views:
    4,602
    =?Utf-8?B?QnJpYW4gTQ==?=
    Nov 16, 2004
Loading...

Share This Page