2017-11-14 5 views
0

の取得中にエラーが発生しました:私が使用エラーメールを送信しようとしている

System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.

コードは以下のとおりである:

using (MailMessage mail = new MailMessage()) 
      { 
       mail.From = new MailAddress(email); 
       mail.To.Add(email); 
       mail.Subject = "Test"; 
       mail.Body = html; 
       mail.IsBodyHtml = true; 

       using (SmtpClient smtp = new SmtpClient(host, int.Parse(port))) 
       { 
        smtp.UseDefaultCredentials = false; 
        smtp.Credentials = new NetworkCredential(email, password); 
        smtp.EnableSsl = true; 
        smtp.Send(mail); 
       } 
      } 
+0

使用しているポート番号は何ですか? – Izzy

+0

@Izzyポート番号は587 です。試しても465です。 – Devi

+0

@MatSnow解決策を試しました...うまくいきませんでした – Devi

答えて

0

は、それが働いたガット.....問題は、ポート番号とありました。試したポート番号25とそれは働いた....

関連する問題