MailMessage message = new MailMessage();
message.From = new MailAddress("MyMailAddress");
message.To.Add("DestinationMailAddress");
message.CC.Add("CCMailAddress");
message.Subject = "This is Subject";
message.SubjectEncoding = System.Text.Encoding.UTF8;
message.BodyEncoding = System.Text.Encoding.UTF8;
message.Body = "This is a test e-mail message sent by an application. ";
SmtpClient client = new SmtpClient();
client.Port = 587;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = true;
client.EnableSsl = true;
client.Host = "smtp.gmail.com";
client.Send(message);
This my code. The error was
Failure sending email.
Inner Exception:
{"Unable to connect to the remote server"} {"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 74.125.68.109:587"} Errorcode:10060