class Object
Public Instance Methods
send_mail(app_name, release, html_changelog, to, from, api_key, headers = {})
click to toggle source
# File mandrillamelo, line 10 def send_mail(app_name, release, html_changelog, to, from, api_key, headers = {}) begin mandrill = Mandrill::API.new(api_key) message = { "tags"=>["changelog"], "to"=> to, "track_opens"=>nil, "headers"=>headers, "view_content_link"=>nil, "auto_text"=>nil, "track_clicks"=>nil, "from_name"=>"Changelog", "subject"=>"[CHANGELOG] #{app_name} #{release}", "html"=>"<h1>#{app_name} Changelog</h1><h2>#{release}</h2>#{html_changelog}", "from_email"=>from, "preserve_recipients"=>true, "auto_html"=>nil, "important"=>false} async = false result = mandrill.messages.send(message, async) rescue Mandrill::Error => e # Mandrill errors are thrown as exceptions puts "A mandrill error occurred: #{e.class} - #{e.message}" # A mandrill error occurred: Mandrill::UnknownSubaccountError - No subaccount exists with the id 'customer-123' raise end end