Skip to content

Instantly share code, notes, and snippets.

@jookyboi
Created March 12, 2013 17:54
Show Gist options
  • Save jookyboi/5145237 to your computer and use it in GitHub Desktop.
Save jookyboi/5145237 to your computer and use it in GitHub Desktop.
# production.rb, test.rb, development.rb or application.rb
YourApp::Application.configure do
config.action_mailer.smtp_settings = {
:address => "smtp.mandrillapp.com",
:port => 25, # ports 587 and 2525 are also supported with STARTTLS
:enable_starttls_auto => true, # detects and uses STARTTLS
:user_name => "MANDRILL_USERNAME",
:password => "MANDRILL_PASSWORD", # SMTP password is any valid API key
:authentication => 'login' # Mandrill supports 'plain' or 'login'
}
# …
end
# app/mailers/your_mailer.rb
class YourMailer < ActionMailer::Base
def email_name
mail :subject => "Mandrill rides the Rails!",
:to => "[email protected]",
:from => "[email protected]"
end
end
# In a controller: YourMailer.email_name.deliver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment