go-gomail / gomail

The best way to send emails in Go.
MIT License
4.32k stars 572 forks source link

gmail login not working #82

Closed steviesama closed 7 years ago

steviesama commented 7 years ago

When I tried to test send an email using my gmail account I get the follow:

panic: 534 5.7.9 Please log in with your web browser and then try again. Learn more at
5.7.9  https://support.google.com/mail/?p=WebLoginRequired d134sm2180690ywb.23 - gsmtp
steviesama commented 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...

connelevalsam commented 7 years ago

Hi, I have the same error, but my mail is already open in browser.

tingxin commented 7 years ago

@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).

connelevalsam commented 7 years ago

@tingxin please do you have like a working example?

kxzk commented 7 years ago

`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.

connelevalsam commented 7 years ago

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?

steviesama commented 7 years ago

@beigebrucewayne Ah yeah, I sorted this out on my own a while back and forgot about the thread. Thanks ya'll.

robdenio commented 6 years ago

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

letmedoitforafew commented 6 years ago

Also, http://scalar.usc.edu/works/gmaillogin/index

itsoflife commented 6 years ago

Successfully sent few emails. Thanks all.

Some things that made it work,

  1. Institute intranet might be blocking the connection : try switching to the mobile's 4G/5G hotspot.
  2. In the security dashboard of google account set "Allow less secure apps:" setting to ON. This setting is visible when you scroll to the bottom of the page.
  3. Enabling or disabling the IMAP setting in the gmail didn't make a difference. You can try.

This standard example is perfect : https://godoc.org/gopkg.in/gomail.v2#example-package

ghost commented 2 years ago

@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