亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

谷歌SMTP服務器出現故障

谷歌SMTP服務器出現故障

Go
慕哥9229398 2022-08-09 20:28:37
我在嘗試使用 Google 的 SMTP 服務器時收到以下錯誤。535 5.7.8 Username and Password not accepted. Learn more at 5.7.8 https://support.google.com/mail/?p=BadCredentials fa15sm2375541pjb.40 - gsmtp這是我的代碼:// Sender data.    from := req.FormValue("email")    //password := "xxxx" //<- log in password fails    password := "xxxx" // <- app password fails    // Receiver email address.    to := []string{        "[email protected]",    }    // smtp server configuration.    smtpHost := "smtp.gmail.com"    smtpPort := "587"    msg := req.FormValue("name") + "\n" + req.FormValue("message")    message := []byte(msg)    auth := smtp.PlainAuth("", from, password, smtpHost)    err := smtp.SendMail(smtpHost+":"+smtpPort, auth, from, to, message)    if err != nil {        tmp.Message = "Message not sent: " + err.Error()        htmlTags["contact"] = tmp        err = tmpl.ExecuteTemplate(w, "send_failure", htmlTags["contact"])    } else {        tmp.Message = "Message sent"        htmlTags["contact"] = tmp        err = tmpl.ExecuteTemplate(w, "send_success", htmlTags["contact"])    }} else {    tmp.Message = "You message has not been sent. Cookies are required to send messages."    htmlTags["contact"] = tmp    err = tmpl.ExecuteTemplate(w, "send_failure", htmlTags["contact"])}該帳戶已啟用2FA并使用應用密碼。允許安全性較低的應用:開發送代碼還存在于具有自簽名證書的服務器上,并給出以下錯誤:Certificate - missingThis site is missing a valid, trusted certificate (net::ERR_CERT_AUTHORITY_INVALID).
查看完整描述

1 回答

?
呼喚遠方

TA貢獻1856條經驗 獲得超11個贊

如果您的用戶名和密碼正確無誤,這些是從任何客戶端使Gmail正常工作的步驟。


# Visit https://accounts.google.com

#

# 1. Click on [Security] menu

# 2. Scroll to section [Less secure app access] and set it to ON

# 3. Scroll to section [Signing in to Google] and set [Use your phone to sign in] to OFF 

# 4. Scroll to section [Signing in to Google] and set [2-step Verification] to OFF

現在,要發送一個簡單的文本/純電子郵件示例:


To: "Jane Doe" <[email protected]>

From: "John Doe" <[email protected]>

Subject: A text/plain email

MIME-Version: 1.0 (Created with SublimeText 3)

Content-Type: text/plain; charset="utf-8"

Content-Transfer-Encoding: 7bit


Good morning.


This is a message in text/plain format.

It contains text/plain.

It contains no base64 inline images or attachments.

Each line is no more than 76 characters in length.


Please reach out if you have any questions.



Thank you,


John Doe

SENIOR DEVELOPER

XYZ Solutions Inc.

P | 999.555.1234

然后,您可以使用 CURL 發送它:


# GMAIL TEST - text-plain.eml

curl --verbose -ssl smtps://smtp.gmail.com:465 --login-options AUTH=PLAIN --user [email protected]:passwword123 --mail-from [email protected] --mail-rcpt [email protected] --mail-rcpt-allowfails --upload-file text-plain.eml 



查看完整回答
反對 回復 2022-08-09
  • 1 回答
  • 0 關注
  • 272 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號