MailMessage message = new MailMessage();
SmtpClient smtp = new SmtpClient();
message.From = new MailAddress("myname@mycompany.com.sg");
message.To.Add(new MailAddress("myname@hotmail.com"));
message.Subject = "In need of help";
message.Body = "Good morning" + txt_name;";
smtp.Port = 465;
smtp.Host = "mail.mycompany.com.sg";
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential("myname@mycompany.com.sg", "xxxxxxxxx");
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Send(message);
MessageBox.Show("email sent");
I have an email code which works when sending email to the same domain but is unable to send to others email platform such as gmail and hotmail. I am receiving this error on my windows
"err: failure sending mail.".
Any help would be greatly appreciated