Email not being sent..

Discussion in 'ASP.NET 2.0' started by rwalker, Jan 24, 2008.

  1. I am having a problem with my sitein that my email feature is no longer working. I don't get any exceptions from SmtpClient.Send, however, the email never arrives at the destination. The email feature has been working for over a year now and I have never had a problem with it. Is there a way to debugwhatis goingwrong? If I test in my local development environment the email is sent. My guess it gets to the DiscountASP.net mail server and it doesn't like something and so the message isn't sent. Is there some mechanism for debugging this or getting information from the mail server?

    Here is the relevant code from the config file and the C# code to send the email.

    web.config settings:




    <mailSettings>
    <smtp deliveryMethod="Network">
    <network defaultCredentials="True" host="LocalHost" port="25" />
    </smtp>
    </mailSettings>





    Code to Send email:


    MailAddress from = new MailAddress(fromEmail);


    // Set destinations for the e-mail message.
    MailAddress to = new MailAddress(toEmail);


    // Specify the message content.
    MailMessage msg = new MailMessage(from, to);
    msg.Subject = subject;
    msg.Body = body;



    SmtpClient mailClient = new SmtpClient();


    try
    {
    mailClient.Send(msg);
    }
    catch (Exception ex)
    {
    LogException(ex);
    }






    Thanks,





    Ray
     
  2. For my ASP.NET v2 contact page my web.config section for the mail is:

    <system.net>
    <mailSettings>
    <smtp>
    <network host="localhost" port="25"/>
    </smtp>
    </mailSettings>
    </system.net>

    And in my pages I'm using:

    Imports System.Net.Mail
    Imports System.Net

    .......
    Dim mm As New MailMessage(UsersEmail.Text, ToAddress)
    Dim BodyString As String = ""
    BodyString &amp;= Body.Text
    ...some junk here to build the body string
    mm.Body = BodyString
    '
    mm.Subject = Subject.Text
    ' mm.Body = Body.Text
    mm.Headers.Add("X-Location", "TAB")
    mm.IsBodyHtml = False
    Dim smtp As New SmtpClient
    smtp.Send(mm)
     
  3. ok, the emails started showing up at about 8 PM last night. Not sure where they were hung up at since myself (and others) had sent multiple emails to different accounts. In any case, the issue seems to have gone away for now.
     
  4. If it had been working previously, create a ticket to tech support. It's possible that the emails are being held up on the server's SMTP queue.




    Aristotle

    DiscountASP.NET
    www.DiscountASP.NET
     
  5. Hi,


    Ihad the same experience after the change at DASP.


    Discovered that the password to the e-mail account had been deleted (well, it wasn't showing up anywhere anyway).
    I recreated that password, and things work now just fine


    Hope this helps


    Dave
     

Share This Page