Я войти в систему page.login работает нормально, но при попытке создать нового пользователя, я получаюпочему получение SMTP ошибки в asp.net
Error:The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.
Вот код, который я использую для отправки почты
public void SendConfirmationAfterRegister(String EmailID, String UserName)
{
MailMessage mailMsg = new MailMessage();
String BodyMsg = UserName + ", \r\n\nWe have recieved your request to become a user of our site. Upon review, we will send you verification for site access.\r\n\n" +
"Thank you, \r\n\nMuda Admin";
try
{
var client = new SmtpClient("smtp.gmail.com", 587)
{
Credentials = new NetworkCredential(ConfigurationManager.AppSettings["AdminEmail"].ToString(), ConfigurationManager.AppSettings["Pwd"].ToString()),
EnableSsl = true
};
mailMsg.IsBodyHtml = true;
client.Send(ConfigurationManager.AppSettings["AdminEmail"].ToString(), EmailID, "Received Your Request", BodyMsg);
client.Send(ConfigurationManager.AppSettings["AdminEmail"].ToString(), "mymailId", "User Needs Access", EmailID + " looking for access the xyz Network Site.");
}
catch (Exception ex) { throw new Exception(ex.Message); }
}
может любой, что это неправильно
Попробуйте сменить номер порта на 25 – Sankar