メール送信者はC#で作成しましたが、実行するとエラーが発生します。C#でメールを送信する際にエラーが発生しました
が、これは私のコードです:
MailMessage mail=new MailMessage("[email protected]","[email protected]","subject","this is a test");
SmtpClient smtp =new SmtpClient("smtp.gmail.com");
smtp.Port=587;
smtp.Credentials= new System.Net.NetworkCredential("username","pass");
smtp.Send(mail);
、これは誤りです:
System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first. 79sm6578238wrc.34 - gsmtp
設定してみてください[ '.EnableSsl = TRUE;'](https://msdn.microsoft.com/en-us/library/system.net.mail.smtpclient.enablessl(V = vs.110) .aspx) – freefaller