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 SinghPosted Sep 1, 2016, 5:45 AM
Send Mail In Asp.Net C# Using Gmail
Rajeesh MenothPosted Sep 1, 2016, 5:40 AM
sameer shaikhPosted Sep 1, 2016, 5:31 AM
Bikesh SrivastavaPosted Sep 1, 2016, 5:29 AM
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.