好傢伙我試圖從我的ASP.Net Web應用程序發送電子郵件我用這對我的web.config:ASP.Net C#發送電子郵件的SMTP問題
<system.net>
<mailSettings>
<smtp>
<network host="smtp.gmail.com" userName="myemail" password="mypass" port="587" enableSsl="true" />
</smtp>
</mailSettings>
這一切都正確的,但我收到此錯誤信息:
System.Net.Mail.SmtpException:
The SMTP server requires a secure connection or not done client authentication.
The server response was: 5.5.1 Authentication Required.
Learn more at at System.Net.Mail.MailCommand.CheckResponse
(SmtpStatusCode statusCode, String response) in System.Net.Mail.MailCommand.Send
(SmtpConnection conn, Byte [] command, MailAddress from, Boolean allowUnicode)
in System.Net. Mail.SmtpTransport.SendMail (MailAddress sender, MailAddressCollection
recipients, String deliveryNotify, Boolean allowUnicode,
SmtpFailedRecipientException & exception) in System.Net.Mail.SmtpClient.Send
(MailMessage message) at Account_Registration.Registration()
in c: \ Users \ User \ Documents \ Visual Studio 2013 \ WebSites \
MyWebsite \ Account \ Registration.aspx.cs: line 177
正如你可以在我的Web.config文件中看到我已經啓用了SSL靜得我得到這個錯誤和電子郵件到我的帳戶有人試圖在未經許可的情況下使用我的電子郵件。任何人都可以幫忙?
可能重複:http://stackoverflow.com/questions/2391079/gmail-c-sharp-web-config-send-mail-works-programmatically-throws-exception –