i am trying to send email by using console application and i have tried following way
MailMessage mail = new MailMessage();
mail.From = new MailAddress("MyEmailAddress", "sameer shaikh");
mail.Subject = "hi";
mail.SubjectEncoding = System.Text.Encoding.UTF8;
mail.Body = "this is body area of that email";
mail.IsBodyHtml = true;
mail.Priority = MailPriority.High;
SmtpClient client = new SmtpClient("smtp.gmail.com",587);
client.Credentials = new NetworkCredential("MyEamilAddress", "xxxxxxxxxx");
client.EnableSsl = true;
//client.UseDefaultCredentials = false;
try
{
client.Send(mail);
Console.WriteLine("send email successfully");
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine("sending failed...");
}
but still getting error server does not support secure connections.
I tryied EnableSssl to false but not done.
please let me know where i am wrong and what is right solution for such problem.
Thanks&Regards
sameer