Hi all,
i am developing web application, so if users want to use this application,first they should be register their details,at the time i have to send Userid and password to their Email address.now i'm have a code but it is not working,i got one error from this code.
the error is " SMTP Exception was caught: The SMTP Server requiers a secure connection or the client was not authenticated. the server response was :5.5.1 Authentication required ".
And also i attached my code.
Please help me anyone.,
Thank you
public Boolean SendMail(String mailId, String mailBody)
{
try
{
System.Net.Mail.MailMessage message;
message = new System.Net.Mail.MailMessage("\"Twaik Group\" <mmmm@gmail.com>", mailId, "Company name", mailBody);
message.Priority = MailPriority.High;
message.IsBodyHtml = true;
//SmtpClient client = new SmtpClient("173.248.137.38");
SmtpClient client = new SmtpClient();
client.Host = "smtp.gmail.com";
client.Port = 25;
client.EnableSsl = true;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential("mmmm@gmail.com", "***********");
client.Send(message);
return true;
}
catch
{
return false;
}
}