2013-02-12 4 views
10

Sto usando seguente pace del codice per inviare posta utilizzando hosting Godaddy.System.Net.Mail.SmtpException: l'operazione è scaduta. errore in asp.net inviare il codice di posta utilizzando hosting Godaddy

ma il suo tiro System.Net.Mail.SmtpException: The operation has timed out.

protected void sendmail() 
    { 
     var fromAddress = "[email protected]"; 
     // any address where the email will be sending 
     var toAddress = "[email protected]"; 
     //Password of your gmail address 
     const string fromPassword = "mypassword"; 
     // Passing the values and make a email formate to display 
     string subject = "HI test mail "; 
     string body = "From: [email protected]"; 
     // smtp settings 
     var smtp = new System.Net.Mail.SmtpClient(); 
     { 
      //smtp.Host = "relay-hosting.secureserver.net"; 
      smtp.Host = "smtpout.secureserver.net"; 
      smtp.Port = 80; 
      smtp.EnableSsl = true; 
      smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network; 
      smtp.Credentials = new NetworkCredential(fromAddress, fromPassword); 
      smtp.Timeout = 20000; 
     } 
     // Passing values to smtp object 
     smtp.Send(fromAddress, toAddress, subject, body); 
    } 
+0

credo porta SMTP con SSL dovrebbe essere 465 – fofik

+0

fammi controllare questo ..thanks anche per il vostro tempo. – rahularyansharma

+0

ancora lo stesso errore :( – rahularyansharma

risposta

-4

Basta cambiare:

smtp.Timeout = 20000;

Per

smtp.Timeout = 2000000;

+0

lol Questo è un timeout killer !? –

+14

LOL. Che ne dici di "client.Timeout = int.MaxValue;"? – Rikki