Created
October 1, 2012 21:01
-
-
Save D3MZ/3814390 to your computer and use it in GitHub Desktop.
mandrill hack.
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
require 'pp' | |
require 'HTTParty' | |
require 'mail' | |
#JSON broken for Mandrill. | |
#class Mandrill | |
# include HTTParty | |
# base_uri 'mandrillapp.com' | |
# def initialize(key) | |
# #@auth = {:email => u, :key => p} | |
# @auth = {:key => key} | |
# end | |
# | |
# def post | |
# options = {...} | |
# self.class.post('/messages/send.json', options) | |
# end | |
# | |
# def info | |
# options = @auth | |
# self.class.post('/users/info.json', options) | |
# end | |
#end | |
# | |
#pp Mandrill.new('8c26b2b1-6d84-4d65-ba28-da0cb53ece20').info | |
#SMTP Seems to work. Nioce | |
Mail.defaults do | |
delivery_method :smtp, { | |
:port => 587, | |
:address => "smtp.mandrillapp.com", | |
:user_name => "[email protected]", | |
:password => "8c26b2b1-6d84-4d65-ba28-da0cb53ece20" | |
} | |
end | |
mail = Mail.deliver do | |
to '[email protected]' | |
#to '[email protected]' | |
from 'Chelsey Konya <[email protected]>' # Your from name and email address | |
subject 'Via Mandrill... Lets see if this works' | |
#text_part do | |
# body 'This is Plain text.' | |
#end | |
# | |
#html_part do | |
# content_type 'text/html; charset=UTF-8' | |
# body '<em>this is some <strong>HTML</strong></em>' | |
#end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment