title: Ruby sending mail via gmail smtp
body: <p>I'm creating a ruby script that checks the response status of an url and if it equals with 504, it sends a mail to another email address. For some reason, I get this: <code>/usr/lib/ruby/1.9.1/net/smtp.rb:960:in 'check_auth_response': 534-5.7.14 &lt;https://accounts.google.com/ContinueSignIn?sarp=1&amp;scc=1&amp;plt=AKgnsbv9z (Net::SMTPAuthenticationError)</code>
  I quadra checked the authentication data and they are valid. Maybe there can be something wrong in the code:</p>
  
  <pre><code>require 'mail'
  
  options = { :address              =&gt; "smtp.gmail.com",
              :port                 =&gt; 587,
              :user_name            =&gt; '&lt;myusername&gt;',
              :password             =&gt; '&lt;mypassword&gt;',
              :authentication       =&gt; 'plain',
              :enable_starttls_auto =&gt; true  }
  
  Mail.defaults do
    delivery_method :smtp, options
  end
  
  Mail.deliver do
         to 'dude920228@gmail.com'
       from 'dude92@dude92.koding.com'
    subject 'Test'
       body 'Hurray!!! Test email!'
  end
  </code></pre>
  
  <p>Oh also, I got the notice from google that a less secure app tried to access my account, so I set up that less secure apps can use my account.</p>