I have this code to send emails but there is an error .... I searched on google and I saw most of the codes that are used are similar to mine...
MailMessage message = new MailMessage();
SmtpClient smtp = new SmtpClient();
message.From = new MailAddress(test.host.com);
message.To.Add(new MailAddress(test@gmail.com));
//not the actual email just a dummy value
message.Subject = "Sending mail";
message.Body = "testing";
smtp.Port = 465;
smtp.Timeout = 30 * 1000,
smtp.Host = "host.com.sg";
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.Credentials = new NetworkCredential("username", "password");
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Send(message);
MessageBox.Show("Message has been sent");
The new error i received was failure sending mail