Unable to send email using C# code and NodeJS

Unable to send email using C# code and NodeJS

We are getting an exception saying that "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 165.254.168.48:25".

when we try to send email using c# Code. Following is sample code which we used to send mail.


  1. try
  2.             {
  3.                 MailMessage mail = null;
  4.                 var from = "XXXXX@domainname.com";
  5.                 var to = "abc@domainname.com";
  6.                 using (mail = new MailMessage(new MailAddress(from), new MailAddress(to)))
  7.                 {
  8.                     mail.Subject = "Test Mail";
  9.                     mail.Body = "This is for testing SMTP mail from GMAIL";
  10.                     mail.To.Add(to);
  11.                     SmtpClient smtpMail = null;
  12.                     using (smtpMail = new SmtpClient("smtp.zoho.com", 465))
  13.                     {
  14.                         smtpMail.Port = 465;
  15.                         smtpMail.EnableSsl = true;
  16.                         smtpMail.Credentials = new System.Net.NetworkCredential("noreply@domainname.com", "testpassword");
  17.                         smtpMail.UseDefaultCredentials = true;
  18.                        
  19.                         smtpMail.Send(mail);
  20.                         Console.WriteLine("sent");
  21.                         Console.ReadLine();
  22.                     }
  23.                 }
  24.             }
  25.             catch (Exception ex)
  26.             {
  27.                 throw ex;
  28.             }

Please let us know if you need more information.