Categories
Heroku

Heroku: sending mail

It is so easy now that mandrill by MailChimp is part of the deal.

1) Add the Mandrill Add On to your site.

2) Include the ‘mail’ gem in your gemset.

3) Example of how to send stuff:

 

require ‘mail’

Mail.defaults do
delivery_method :smtp, {
:port => 587,
:address => “smtp.mandrillapp.com”,
:user_name => “your mandrill username here”,
:password => “your mandrill API key”
}
end

mail = Mail.deliver do
to ‘somebody@gmail.com’
from ‘JohnYo DoeMero <johnmero@somewhere.com>’
subject ‘Test email via Mandrill!’

text_part do
body ‘This is the email body message’
end

html_part do
content_type ‘text/html; charset=UTF-8’
body ‘<em>And, the HTML counterpart <strong>is working!</strong></em>’
end
end

Leave a Reply

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