ActionMailer-JavaMail: Rails E-Mail on Google App Engine
ActionMailer-JavaMail is a jRuby gem that lets you send emails from your jRuby on Rails on Google App Engine application, but also works in standard SMTP and SMTPS scenarios. The greater intent of this gem also includes utilizing JavaMail extensions that don’t have equivalents in Ruby.
I originally created this gem to bulletproof my emails from spam filters by adding DKIM signing. A few big email providers use DomainKeys Identified Mail (DKIM) as part of their anti-spam strategy. I found and used a Java DKIM library, because I did not find one for Ruby.
Features Overview
- Send email via SMTP or SMTPS
- Send emails via Google App Engine
- DKIM message signing
Installing
sudo jruby -S gem install actionmailer-javamail
Configuring for SMTP over SSL (in a config/initializers file)
ActionMailer::Base.delivery_method = :javamail
ActionMailer::Base.javamail_settings = {
:protocol => :smtps,
:address => 'smtp.gmail.com',
:port => 465,
:domain => 'mydomain.com',
:user_name => 'user@gmail.com',
:password => 'password',
}Configuring for Google App Engine (Mail API):
ActionMailer::Base.delivery_method = :javamail
ActionMailer::Base.javamail_settings = { :protocol => :gm }Requirements:
Please make sure that you have a recent version of the JavaMail JARs in your CLASSPATH for non-Google App Engine use. I didn’t include them in the package to avoid conflicts with Sun’s license and Google App Engine’s internal libraries.
Source:
The source is at http://github.com/rykov/actionmailer-javamail
Demo on Google App Engine:
Try the demo at http://am-javamail.missingfeature.com/test/email
The source is at http://github.com/rykov/yarbl (based Ola Bini’s example)
Note: refresh a few times if the demo throws errors while warming up