Created
March 12, 2013 17:54
-
-
Save jookyboi/5145237 to your computer and use it in GitHub Desktop.
Hook up Mandrill with Ruby on Rails. http://help.mandrill.com/entries/21738467-Using-Mandrill-s-SMTP-integration-with-Web-Frameworks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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