C# Email sending error on Godaddy server

后端 未结 3 1866
遥遥无期
遥遥无期 2021-01-22 02:39

I have one web application which hosted on Godaddy server. I am stuck with Failure sending mail error. I place my code here

public void Mailing()
{
 MailMess         


        
3条回答
  •  庸人自扰
    2021-01-22 03:15

    EnableSsl should be true. If you need a timeout then its property should be set before the email is sent try adjusting like this

    SmtpClient smtpClient = new SmtpClient();
    smtpClient.Host = "relay-hosting.secureserver.net";
    smtpClient.Port = 465;
    smtpClient.EnableSsl = true;
    smtpClient.UseDefaultCredentials = false;
    smtpClient.Credentials = 
              new NetworkCredential("mailadress@server.net", "Password");
    
    ...
    smtpClient.Timeout = 10000;
    smtpClient.Send(message);
    

提交回复
热议问题