Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gmail login not working #82

Closed
steviesama opened this issue Apr 15, 2017 · 11 comments
Closed

gmail login not working #82

steviesama opened this issue Apr 15, 2017 · 11 comments

Comments

@steviesama
Copy link

steviesama commented Apr 15, 2017

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
Copy link
Author

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
Copy link

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

@tingxin
Copy link

tingxin commented Jun 9, 2017

@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
Copy link

@tingxin please do you have like a working example?

@kxzk
Copy link

kxzk commented Jul 16, 2017

`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
Copy link

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
Copy link
Author

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

@robdenio
Copy link

robdenio commented Oct 22, 2017

@letmedoitforafew
Copy link

@itsoflife
Copy link

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
Copy link

ghost commented Nov 2, 2021

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants
@steviesama @tingxin @connelevalsam @kxzk @robdenio @letmedoitforafew @itsoflife and others