Nodemailer: working in Local but when commit and Run on heroku server It's FAIL.

Created on 11 May 2016  路  22Comments  路  Source: nodemailer/nodemailer

1) Nodemailer version "nodemailer": "~1.8.0"
2) Node.js version -
3) Your operating system
On heroku cloud so don't know

http://nodemailer.com/using-gmail/ Also I checked These link when I enable Less Enable Apps than Email send for some Time than after Fail to send.

503 (Service Unavailable)

                     ` var nodemailer = require('nodemailer');
                      var smtpPool = require('nodemailer-smtp-pool');
                      var transporter = nodemailer.createTransport(smtpPool({
                       service: 'gmail',
                         auth: {
                                  user: '[email protected]',
                                  pass: 'Test$$123'
                            },
                            maxConnections: 50,
                            maxMessages: 100
                       }));

                       var htmlContent = '<p>test</p>'
                        var options = {
                            from: 'Support <'+config.siteemail+'>',
                            to: user.email,
                            subject: 'Registration Acknowledgement',
                            html: htmlContent
                        };

                        transporter.sendMail(options, function(error, info){
                            if(error){
                                return console.log(error);
                            }else{
                                console.log('Message sent: ' + info.response);
                                res.end("sent");   
                            }
                        });`

ERROR :

2016-05-10T07:47:20.403737+00:00 app[web.1]: { [Error: Invalid login: 534-5.7.14 https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbsHB45wasWMHlfgm-psVzQDyobEJwiWbb7PwR7FgSwfy5u44bWvSR6H8eeYPcgOS5npXuB7s6hkkW25lADnuKNGU9hf6xqr7AdxW0ZBqQFcixFSXFUZ5yX8ILKU1e7BP5UVSKmOxtVDeGRwFdpfrLwG5y8BqHDOKv7lnLkzWTNrCsxeVq07uqcDSTM31tRWzK6xshc0FSt14z3vUgnQIK0Rf9skbZo92Inrma-ksPGelkAHZx0 Please log in via your web browser and
Learn more at https://support.google.com/mail/answer/78754 b40sm328776qga.47 - gsmtp] at=error code=H12 desc="Request timeout" method=POST path="/api/users/register" host=shaadibelles.herokua

Most helpful comment

Try this,
https://accounts.google.com/b/0/DisplayUnlockCaptcha
This will allow machines to access your gmail remotely.

All 22 comments

Gmail does not work well in production with normal authentication. See this post for more information.

Link broken. :(

@higunjan did you solve it?

Try this,
https://accounts.google.com/b/0/DisplayUnlockCaptcha
This will allow machines to access your gmail remotely.

@shubham-awr tks, problem solved!!!

I am still having the same problem even with the DisplayUnlockCaptcha...

Do you have any tips??

@oliviercperrier - Did you fix this problem?

https://accounts.google.com/b/0/DisplayUnlockCaptcha this works.
I received an email by Google that my acccount was being accessed from the server location, if you do just tell Google not to block it.
Those were the steps I took to get it working.

Didn't work for me at first with DisplayUnlockCaptcha, but it worked after I sent a mail immediatly after trying this. I suppose that at first there were issues related to the fact that I have several gmail accounts running on the same browser.

@ninofiliu was correct. Try and close all open gmail accounts except the one you plan to use as the mailer. Navigate to https://accounts.google.com/b/0/DisplayUnlockCaptcha, while that page is open redeploy the app via heroku. You should be good after that.

@CRFullStack I had the same issue as OP and I used the link(https://accounts.google.com/b/0/DisplayUnlockCaptcha) with my correct gmail account signed in; redeployed the app to heroku. It was fine for the rest of the day but my nodemailer broke after 2 days. I re-visited: https://accounts.google.com/b/0/DisplayUnlockCaptcha and it was fine again.

Any idea as to why I had to re-enable again? Is there a more permenant solution?

Thanks ver much in advance

Try this,
https://accounts.google.com/b/0/DisplayUnlockCaptcha
This will allow machines to access your gmail remotely.

great

Try this,
https://accounts.google.com/b/0/DisplayUnlockCaptcha
This will allow machines to access your gmail remotely.

16 april 2020, problem solved with the unlockCaptcha's solution.

@c-ywj did you find any solution?

works like magic
thanks @Codexdrip

Can you explain.. Again?

works like magic
thanks @Codexdrip

Locally m getting but through heroku m not.

@Abhay304 @KowsalyaR97
If locally works and on heroku it won't then please enter the strong password for your Gmail like gU_&#!Gs645.

Also, please check
https://accounts.google.com/b/0/DisplayUnlockCaptcha

Is it enable or not.

@Abhay304 @KowsalyaR97
If locally works and on heroku it won't then please enter the strong password for your Gmail like gU_&#!Gs645.

Also, please check
https://accounts.google.com/b/0/DisplayUnlockCaptcha

Is it enable or not.

For this it is asking me to enable 2 step authentication.

@ninofiliu was correct. Try and close all open gmail accounts except the one you plan to use as the mailer. Navigate to https://accounts.google.com/b/0/DisplayUnlockCaptcha, while that page is open redeploy the app via heroku. You should be good after that.

Thank you so much. This worked after so many failed attempts.

can get to solve this error after hosting my website on heroku............
SMTPAuthenticationError at /contact.html
(534, b'5.7.14 \n5.7.14 Please log in via your web browser and then try again.\n5.7.14 Learn more at\n5.7.14 https://support.google.com/mail/answer/78754 p33sm10235144qtp.49 - gsmtp')

even after enabling this ,.......
https://accounts.google.com/b/0/DisplayUnlockCaptcha,

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sarahpy picture sarahpy  路  11Comments

abhatia-lix picture abhatia-lix  路  7Comments

jonathanong picture jonathanong  路  12Comments

AshishkrGoyal picture AshishkrGoyal  路  17Comments

miiiku picture miiiku  路  13Comments