Hi
Once again
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.To.Add(new MailAddress("[email protected]"));
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

Vinay SinghRank #604 · 4K reputationPosted Sep 1, 2016, 1:45 AM EDT
Send Mail In Asp.Net C# Using Gmail
Bikesh SrivastavaRank #108 · 20.3K reputationPosted Sep 1, 2016, 1:29 AM EDT
That error message is typically caused by one of the following:
- Incorrect connection settings, such as the wrong port specified for the secured or non-secured connection
- Incorrect credentials. I would verify the username and password combination, to make sure the credentials are correct.
Please ensure these things and try again.sameer shaikh181 reputationPosted Sep 1, 2016, 1:31 AM EDT
Rajeesh MenothRank #118 · 18.4K reputationPosted Sep 1, 2016, 1:40 AM EDT