mscdex / node-imap

An IMAP client module for node.js.
MIT License
2.17k stars 382 forks source link

gmail #795

Closed melitus closed 4 years ago

melitus commented 4 years ago

I was able to connect and download an email attachment from the localhost. But could not connect when tried the same process when hosted on Heroku. I kept getting the response below

Trace: { Error: Please log in via your web browser: https://support.google.com/mail/accounts/answer/78754 (Failure)

This is my imap setting below

const imap = new Imap {
        user: imapServerSettings.username  as string,
        password: imapServerSettings.password  as string,
        host: imapServerSettings.host  as string,
        port: imapServerSettings.port as number,
        tls: imapServerSettings.tls as boolean,
}
mscdex commented 4 years ago

Did you try the suggested troubleshooting steps at the URL? This seems like a gmail account-specific issue, not an issue with this module.

melitus commented 4 years ago

@mscdex Thanks for your reply. I am not trying to infer that it is a problem with this module, This module has been so amazing. I tested downloading from Gmail on the localhost and it worked perfectly, but when I hosted on Heroku, it could not connect to the Gmail IMAP again. I would appreciate if anyone who have experimented with this on Gmail on live server could help me with a guide, Thanks

mscdex commented 4 years ago

My guess is that Google sees you logging in from a different IP that it doesn't recognize or it has seen lots of spam come from Heroku's IP addresses so it blocks access.

However I think your question might be more suitable for (and would have more eyes on it at) a place like stackoverflow or perhaps Heroku support/forums.

melitus commented 4 years ago

Thanks

kaceman commented 4 years ago

@melitus I am having the same issue here, it's working on my local machin, but when I host it on linode (ubuntu machine) I have the same error you had, is there any solution for that?