Closed steviesama closed 7 years ago
Well I don't know what to say man. I was looking and making sure I had less secure apps turned on and some other stuff. It was already on. But I was about to try another package for it, and I accidentally ran the program test before recompiling testing the new package and the same thing that didn't work before worked without changes...
Hi, I have the same error, but my mail is already open in browser.
@steviesama similar issue. i fix it by enabled the IMAP setting follow https://support.google.com/mail/answer/7126229?hl=en, and low the app secure(you can login you gmail dashboard to find the entry).
@tingxin please do you have like a working example?
`package main
import ( "gopkg.in/gomail.v2" )
func main() {
m := gomail.NewMessage()
m.SetHeader("From", "from@gmail.com")
m.SetHeader("To", "to@gmail.com")
m.SetHeader("Subject", "Header Text")
m.SetBody("text/html", "Body Text")
d := gomail.NewDialer("smtp.gmail.com", 587, "username", "password")
if err := d.DialAndSend(m); err != nil {
panic(err)
}
}`
This code works, as @tingxin mentioned...if you haven't lowered the security on your Gmail account it won't allow you to send. It's happened to me before when writing a similar program in Python. Probably just need to add a quick section in readme.
yeah thanks. The receiver will get it in their spam message. It's not legit as others usually is. Or don't they use their web? do they send it via gmail itself?
@beigebrucewayne Ah yeah, I sorted this out on my own a while back and forgot about the thread. Thanks ya'll.
Found a selection of articles if your still having issues with gmail
http://scalar.usc.edu/works/gmail/index http://scalar.usc.edu/works/gmail/gmail-login http://scalar.usc.edu/works/gmail/gmail http://scalar.usc.edu/works/gmail/login
Successfully sent few emails. Thanks all.
Some things that made it work,
This standard example is perfect : https://godoc.org/gopkg.in/gomail.v2#example-package
@itsoflife Thanks your 1st point saved me tried several time changing a lot of setting turning things on and off at the end read your comment and found that the internet service i was using was blocking it
When I tried to test send an email using my gmail account I get the follow: