Closed bronze1man closed 9 years ago
Which port do you use? Can you show your code?
Here is my code.
func sendToGmail()(err error){
addr:="xxx@gmail.com"
msg := gomail.NewMessage()
msg.SetHeader("From", addr)
msg.SetHeader("To", addr)
msg.SetHeader("Subject", "测试邮件1")
msg.SetBody("text/html", "测试邮件2")
mailer:=gomail.NewMailer("smtp.gmail.com","xxx@gmail.com","xxxx",587,
gomail.SetTLSConfig(&tls.Config{InsecureSkipVerify: true}))
return mailer.Send(msg)
}
Here is the error
panic: 534 5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbtAP
5.7.14 mQRlt2S9ePao63HrBtSFL1b1MG3Ocz18RUf-xxxx
5.7.14 UT-xxx
5.7.14 HQhxZ_UwksmmOn40ozznhsLBJTAMx5KoSOEQ4dn7zGLYHiwfWkXv3ZbGmKawb4yeGcrlSj
5.7.14 e7Syp0nSjFiK6jN05nIseC97iU_Q> Please log in via your web browser and
5.7.14 then try again.
5.7.14 Learn more at
5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 r8sm2320369pdp.10 - gsmtp
Do you also get this error when you remove the custom TLS configuration?
Yes.
I think there are two ways to fix this issue:
In both cases it is outside the scope of Gomail. Although if you or someone else implements an Oauth2 authentication mechanism I might consider adding it to Gomail.
Thanks for your great job. I will turn off the secure option.
I am also having this issue. Is this still the most up to date way to make gomail work with Gmail? I am confused how enabling 2step would help this. Wouldn't that mean that gomail would never be able to login because it will never be able to authenticate with the second auth mechanism?
I was able to get this working by using the 2step verification and by generating an 'app token' which is used as the password in this case. Thanks...
I use gmail account to send a email,but it return a error with a warning. I can fixed it by turn off some secure stuff. https://support.google.com/accounts/answer/6010255?hl=en
Can this stuff be fixed in this library?