Rails 2.0: Gmail SMTP With ActionMailer

Marc just checked in a nifty little Rails 2.0 plugin to the OpenRain public subversion repository which encapsulates the voodoo required to use a Gmail SMTP server with an otherwise ordinary ActionMailer configuration. Gmail requires TLS security, which is why this is useful. Grab the plugin for your Gmail-mooching Rails 2.0 site, here.

Note: I previously wrote about how to do this for Rails 1.2.x here.

Update (2008.06.25): Broken download link fixed!

 

7 thoughts on “Rails 2.0: Gmail SMTP With ActionMailer”

  1. Hey Preston,
    I’m having a bit of a problem with the plugin. It works perfectly when I test it in my local dev environment, but in my production environment the emails never get sent and I see errors in the logs like this:

    -> “220 mx.google.com ESMTP f45sm9565579pyh.24\r\n”
    “250-mx.google.com at your service, [67.207.129.71]\r\n”
    -> “250-SIZE 28311552\r\n”
    -> “250-8BITMIME\r\n”
    -> “250-STARTTLS\r\n”
    -> “250 ENHANCEDSTATUSCODES\r\n”
    “220 2.0.0 Ready to start TLS\r\n”
    “250-mx.google.com at your service, [67.207.129.71]\r\n”
    -> “250-SIZE 28311552\r\n”
    -> “250-8BITMIME\r\n”
    -> “250-AUTH LOGIN PLAIN\r\n”
    -> “250 ENHANCEDSTATUSCODES\r\n”
    “535-5.7.1 Username and Password not accepted. Learn more at \r\n”
    -> “535 5.7.1 http://mail.google.com/support/bin/answer.py?answer=14257 f45sm9565579pyh.24\r\n”

    I’m 100% positive that the username and password are correct as the mailer.yml file is exactly the same in production and development. In fact, here’s my mailer.yml (with user/pass removed of course):


    :address: smtp.gmail.com
    :port: 587
    :user_name: blah@blah.com
    :password: blah
    :authentication: :plain

    Any ideas?

    Thanks in advance…

  2. @Brent

    Hmm… sorry, haven’t seen that before. You might want to ask Marc Chung though. (Email address in the README.) He’s the official maintainer of the plugin.

  3. Brent,

    Did you ever resolve your issue? I’m having the exact same problem. If so, please post the fix – many thanks in advance.

    Thanks,

    – Taurus

Leave a Reply

Your email address will not be published. Required fields are marked *