![](/img/trans.png)
[英]The SMTP server requires a secure connection or the client was not authenticated
[英]The SMTP server requires a secure connection or the client was not authenticated (GMAIL)
因此,我一直在嘗試使用Google的smtp服務器設置聯系表單,但我在標題中寫了錯誤。 我試圖在線查找解決方案,並且已經將密碼更改為安全密碼,我禁用了gmail帳戶的安全性,我從服務器的網絡瀏覽器登錄到gmail帳戶。 關於如何解決這個問題有什么想法嗎?
Dim strFrom = "EMAIL@gmail.com"
Dim strTo = "RECEPIENT@EMAIL.net"
Dim MailMsg As New MailMessage(New MailAddress(strFrom.Trim()), New MailAddress(strTo))
MailMsg.BodyEncoding = Encoding.Default
MailMsg.Subject = "This is a test"
MailMsg.Body = "This is a sample message using SMTP authentication"
MailMsg.Priority = MailPriority.High
MailMsg.IsBodyHtml = True
'Smtpclient to send the mail message
Dim SmtpMail As New SmtpClient
Dim basicAuthenticationInfo As New System.Net.NetworkCredential("EMAIL@gmail.com", "PASSWORD")
SmtpMail.Host = "smtp.gmail.com"
SmtpMail.Port = "587"
SmtpMail.UseDefaultCredentials = False
SmtpMail.Credentials = basicAuthenticationInfo
SmtpMail.Send(MailMsg)
你好親近
您需要添加以下設置才能使其正常工作:
smtpMail.enabledssl = true
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.