Email configuration: rails 4, gmail, godaddy

April 15, 2016 433 views
Ruby on Rails DNS Ubuntu

How to configure: rails 4, gmail, godaddy ?
Im using this configuration for my own email/domain: contact@mydomain.com

    address: smtp.gmail.com
    port: 587
    domain: mydomain.com
    user_name: contact
    password: password
    authentication: plain
    enable_starttls_auto: true

I receive 2 kind of errors:

  1. *Net::SMTPAuthenticationError: 534-5.7.9 Please log in with your web browser and then try again. Learn more at
  2. eoferror-end-of-file-reached
2 Answers

It sounds like you are encountering a Google security feature based on the request that you log in with a web browser. Logging into your google account from a browser on your droplet looks like it would resolve that but since most people do not have a need for a graphical environment on their server and text based browsers can be finicky with newer technologies I would recommend setting up a free account somewhere like sendgrid that would allow you to set up SMTP access easily from your server using the method you already are, still use the sender/reply-to address you want and avoid the extra steps.

For the STMP error, Google prefers you to use OAuth for authenticating, otherwise you might get errors like this when connecting. You can try a few different things to get around this:

  1. Create an 'app specific' password for your account and use that in your configuration
  2. Enable the 'use less secure apps' setting on your gmail account, then you can use your normal password (this isn't supported with two-factor authentication enabled on your account)

Hope this helps!

  • Thanks for you answer guys. The problem was that when you bought a Google Apps for Work
    domain. On the security section (On the general app admin) you have to permit 'Use less secure apps' for all accounts.

    This option is difficult to find.

Have another answer? Share your knowledge.