How to Resolve Unable to Connect to the Remote Server When Sending Email

This error indicates that your application is unable to connect with your mail server. you need to check with your mail server, is everything working fine?

you need to check also that you are passing server name and port in right way.

Wrong:

  1. client.Host = "mail.someco.com:10000";    
Correct:
  1. clicnt.Host = "mail.someco.com"; client.Port = 10000;    
and if you are using some other server like you are trying to send the email using gmail. then check your port You can try this code.

  1. var smptClient = new SmtpClient("smtp.gmail.com", 587)  
  2.  {  
  3.      Credentials = new NetworkCredential("[email protected]""123456789"),  
  4.      EnableSsl = true  
  5.  };  
  6.   smptClient.Send("[email protected]""[email protected]""Testing Email""testing the email");  
Next Recommended Reading How to Recall a Sent Mail on Gmail