Amintas Lopes Neto
Amintas Lopes Neto

Reputation: 165

Email Not Sending ASP .NET

We have develop an application that sends email to the user after he confirms a visit to our branch. It works fine when we use the following Gmail configuration: Email: [email protected] Passwd: XXXXX SMTP Server: smtp.gmail.com Port: 587 However, when we try using our domain-based account it simply dosen't work. We are using the following parameters: Email: [email protected] Passwd: XXXXX SMTP Server: smtpout.secureserver.net Port: 465

Code snippet below:

 using (System.Net.Mail.MailMessage mm = new System.Net.Mail.MailMessage(from, to))
            {
                mm.Subject = subject;
                mm.Body = body;
                mm.IsBodyHtml = false;
                System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
                smtp.EnableSsl = true;
                NetworkCredential NetworkCred = new NetworkCredential(from, password);
                smtp.UseDefaultCredentials = true;
                smtp.Credentials = NetworkCred;
                smtp.Host = smtpHost;
                smtp.Port = smtpPort;
                try
                {
                    smtp.Send(mm);
                }
                catch (Exception ex)
                {
                    throw ex;  
                }                
            }
            return;
        }

Is there anything missing? Suggestions are welcome.

Thx

Upvotes: 0

Views: 99

Answers (1)

seiya1223
seiya1223

Reputation: 582

Check the SmtpStatusCode first.

try
    {
  client.Send(message);
    }
    catch (SmtpException e)
    {
    Console.WriteLine("Error: {0}", e.StatusCode);
    }

Try set EnableSsl to False.

Finally, you can lookup the server your email is associated to by logging into your godaddy account, launching the email service, click on "Domains" in the left nav, the click on server addresses in the horizontal nav.

Upvotes: 1

Related Questions