title: Rails 4 ActionMailer with gmail Net::SMTPAuthenticationError: 534-5.7.14
body: <p>I am trying to send an email in development version of my app. Nothing I am doing is working. I keep getting hit with: 
  <strong>Net::SMTPAuthenticationError: 534-5.7.14 <a href="https://accounts.google.com/ContinueSignIn?sarp=1&amp;scc=1&amp;plt=blahblahblah" rel="nofollow noreferrer">https://accounts.google.com/ContinueSignIn?sarp=1&amp;scc=1&amp;plt=blahblahblah</a></strong></p>
  
  <p>Other SO posts I have followed:</p>
  
  <p><a href="https://stackoverflow.com/questions/18124878/netsmtpauthenticationerror-when-sending-email-from-rails-app-on-staging-envir">Net::SMTPAuthenticationError when sending email from Rails app (on staging environment)</a></p>
  
  <p><a href="https://stackoverflow.com/questions/25209676/running-into-smtp-error-when-trying-to-send-email-in-ror-app">Running into SMTP error when trying to send email in RoR app</a></p>
  
  <p>... etc... and nothing works. I'm going to tear my brains out if can't be resolved. I have spent so long on this...</p>
  
  <p>I have tried going directly to <a href="http://www.google.com/accounts/DisplayUnlockCaptcha" rel="nofollow noreferrer">http://www.google.com/accounts/DisplayUnlockCaptcha</a> and click continue, no results. I have already in my google account settings enabled less secure apps access(Google -> Security -> Account permissions -> Access). I have tried going to the link posted after the error, and logged in from there, and no results.</p>
  
  <p>My setup in config/environments/development.rb</p>
  
  <pre><code>  config.action_mailer.default :charset =&gt; "utf-8"
    config.action_mailer.perform_deliveries = true
    config.action_mailer.raise_delivery_errors = true
    config.action_mailer.delivery_method = :smtp
    config.action_mailer.smtp_settings = {
      address: 'smtp.gmail.com',
      port: 587,
      domain: 'mysite.com',
      user_name: ENV['MAIL_EMAIL'],
      password: ENV['MAIL_PASS'],
      authentication: 'plain',
      enable_starttls_auto: true
    }
  </code></pre>
  
  <p>If this makes any difference:</p>
  
  <p>From the apache error logs:</p>
  
  <p><strong>Warning: Name-based SSL virtual hosts only work for clients with TLS server name indication support</strong></p>
  
  <p>I am hosting two domains on the same IP address.</p>
  
  <p>I switched my rails app to production mode, to see if it would help. No results.</p>
  
  <p>Please help.</p>