title: Sending an email in Rails
body: <p>I'm trying to send an email using Ruby on Rails but I get the error:</p>
  
  <blockquote>
    <p>Net::SMTPAuthenticationError in UsersController#create</p>
    
    <p>535-5.7.1 Username and Password not accepted.</p>
  </blockquote>
  
  <hr>
  
  <p>But the username and password combination is correct. I've gone through it multiple times.</p>
  
  <p>This is my setup_mail.rb:<br>
  I changed the username, password and domain for privacy reasons.</p>
  
  <pre><code>ActionMailer::Base.smtp_settings = { 
      :address            =&gt; "smtp.gmail.com",
      :port               =&gt; 587,
      :domain             =&gt; "mydomain.com",
      :authentication     =&gt; "plain",
      :user_name          =&gt; "myname",
      :password           =&gt; "mypw",
      :enable_starttls_auto   =&gt; true
  }
  </code></pre>