title: Action Mailer error: 535-5.7.8 Username and Password not accepted
body: <p>I have a Rails application which uses a form to collect message details and emails the message to my gmail/yahoo account.</p>
  
  <p>I have added this to setup_mail.rb in config/initializers:</p>
  
  <pre><code>ActionMailer::Base.smtp_settings = {  
        :address              =&gt; "smtp.gmail.com",  
        :port                 =&gt; 587,  
        :user_name            =&gt; "my_user",
        :password             =&gt; "my_pass", 
        :authentication       =&gt; "plain",  
        :enable_starttls_auto =&gt; true  
    }
  </code></pre>
  
  <p>and use the controller like so for the POST route: </p>
  
  <pre><code>def create
      @message = Message.new(params[:message])
  
      if @message.valid?
        NotificationsMailer.new_message(@message).deliver!
        redirect_to(root_path, :notice =&gt; "Message was successfully sent.")
      else
        flash.now.alert = "Please fill all fields."
        redirect_to('#')
      end
  end
  </code></pre>
  
  <p>The Message Parameters are accepted from the form cleanly like so:</p>
  
  <pre><code>  Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"4xgV0umvaTPzYxd18qdJq/GT7QCdXjrPTGR7D9R3AC4=", "message"=&gt;{"name"=&gt;"Deepak", "email"=&gt;"deepakm.ccx@gmail.com", "subject"=&gt;"Hi", "body"=&gt;"Hi"}, "commit"=&gt;"Send"}
  </code></pre>
  
  <p>No matter if I use Yahoo credentials or Gmail Credentials in the setup, I keep getting the same error message. I commented all the settings in ActionMailer::Base.smtp_settings and still get this issue. This leads me to believe the issue could be related to something else outside this code but I have no clue whatsoever.</p>
  
  <p>-Deepak</p>