Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Delivery plug for actionmailer

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .document
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 TODO.md
Octocat-spinner-32 VERSION
Octocat-spinner-32 action-gmailer.gemspec
README.md

ActionMailer delivery method for oauth2/smtp

Build Status

Get access to Gmail IMAP and STMP via OAuth2 using ActionMailer or just a plain Mail::Message

It's using the gmail_xauth gem so it can be extended to support a few other auth variants pretty simple.

Installation

Add the following to your Gemfile:

gem 'action-gmailer'

Configuration

You need to set oauth2_token and account to send mail with ActionGmailer. For more information, check SASL XOAUTH2

Using Rails and ActionMailer:

settings = {
  smtp_host:    'FIXME', # default: 'smtp.gmail.com'
  smtp_port:    'FIXME', # default: 587
  helo_domain:  'FIXME', # default:'gmail.com'
  auth_type:    'FIXME', # default: :xoauth2
  oauth2_token: 'FIXME',
  account:      'FIXME'
}

config.action_mailer.delivery_method = :action_gmailer
config.action_mailer.action_gmailer_settings = settings

Using a plain Mail::Message

mail = Mail.new {
  from    "from@example.com"
  to      "to@example.com
  subject "test subject"
  body    'test mail body'
}
mail.delivery_method ActionGmailer::DeliveryMethod, settings

Testing/Development

Run all tests

rake

Run all tests with sending a live email, uncomment the skips and set some secret env variables.

ACTION_GMAILER_ACCOUNT='joel@example.com' ACTION_MAILER_OAUTH2_TOKEN='FIXME' rake

Contributing to action_gmailer

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright (c) 2013 Joel Larsson. See LICENSE.txt for further details.

Something went wrong with that request. Please try again.