
Error Message :
This error will occur when u try to send mail from your web application
"the smtp server requires a secure connection or the client was not authenticated"
This error will occur when u try to send mail from your web application
"the smtp server requires a secure connection or the client was not authenticated"
Cause : due to the Network Credential we will receive this error when we use any third pary smtp servers
SOLUTION :
string sMailServer = "smtp.gmail.com";
MailMessage mailmsg = new MailMessage("sampl@gmail.com", "sampl2@gmail.com", "HAI", "Success ! ");
SmtpClient smtpclt = new SmtpClient();
System.Net.NetworkCredential basicauth = new System.Net.NetworkCredential("sampl@gmail.com", "007");
smtpclt.Host = sMailServer;
smtpclt.UseDefaultCredentials=false;
smtpclt.Credentials=basicauth;
smtpclt.EnableSsl = true;
smtpclt.Send(mailmsg);
SOLUTION :
string sMailServer = "smtp.gmail.com";
MailMessage mailmsg = new MailMessage("sampl@gmail.com", "sampl2@gmail.com", "HAI", "Success ! ");
SmtpClient smtpclt = new SmtpClient();
System.Net.NetworkCredential basicauth = new System.Net.NetworkCredential("sampl@gmail.com", "007");
smtpclt.Host = sMailServer;
smtpclt.UseDefaultCredentials=false;
smtpclt.Credentials=basicauth;
smtpclt.EnableSsl = true;
smtpclt.Send(mailmsg);
No comments:
Post a Comment