1

I am trying to send email from my node.js app using nodemailer. I am successful in sending email from my local server after enabling less secure apps on google account.

But when I deployed my code to heroku, it is unable to send email because google is blocking my login attempts. So I logged in to my account and clicked on the option that the login attempt was from me indeed. However it still is not working. I then set up a project on runnable.com and got the same sign in prevented. I did the same for this and accepted it as my sign in attempt. However I am still not able to send emails.

The error that is coming is this :

Server listening on port 80                                                                                                                                                                              
Failed in sending mail                                                                                                                                                                                   
{ success: false, existing: false, sendError: true }                                                                                                                                                     
{ [Error: Invalid login]                                                                                                                                                                                 
  code: 'EAUTH',                                                                                                                                                                                         
  response: '534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbsNg\n534-5.7.14 LiCfP8u0IX20V3Y1nFt7iYuwJCPg4LVgRxVvEPO5y4-XOjzSsm_xa0XIBE3NP2bM5euv4A\n534-5.7.14 m6LSg0_DQ  
Qj9kOm_JuwykQxVyYSKaLGyeibhi_cHtx3Pu4I4UISJCPt3TvHdxCUebMzTbu\n534-5.7.14 2F9wLa-IFpKHf9HPap4Aeu11Nup9ZAlpOCGAmcnbERFeAufeIgAsExtGkrmV2X7mktJ5nq\n534-5.7.14 epNHDpwg2EwMVwzOrpt8rGZahYvs> Please log i  
n via your web browser and\n534-5.7.14 then try again.\n534-5.7.14 Learn more at\n534 5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 a76sm5828252oig.11 - gsmtp',                     
  responseCode: 534 }

Please Help. I am in desperate need of getting it running.

Ishan
  • 3,303
  • 5
  • 29
  • 47
  • I have the same issue and always after my app is deployed I have to do it again. Any solution? – Luis Felipe Perez Dec 17 '15 at 23:23
  • Well as far as I can tell enabling less secure apps is the only option. I guess it takes a couple of days for this setting to be completely activated as I don't have this error anymore. And I am using the same code. – Ishan Dec 18 '15 at 02:22
  • Yeah, that's true! It took sometime to be completely activated. It's working fine now! Thank you :D – Luis Felipe Perez Jan 05 '16 at 16:53

1 Answers1

1

I have the same issue, grap the link on your respone message "https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbsNg\n534-5.7.14" and paste to browser, you will see an announcement that showing google just blocked your sign-in request by cause it perform from strange device, then you can follow google instruction to accept that device. It's work in my case. But I don't know what happen if heroku dynos sleep then waked up again, maybe it change the machine and you would got this problem again. In this case, considering using a vps for hosting your mailing app.

Foxeye.Rinx
  • 420
  • 2
  • 6