Created
August 2, 2011 06:27
-
-
Save temochka/1119689 to your computer and use it in GitHub Desktop.
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 'tmail' | |
require 'postmark' | |
module Mailer | |
class PostmarkTransport | |
attr_accessor :content_type | |
def initialize(api_key) | |
Postmark.api_key= api_key | |
end | |
def send_message(from, to, subject, body) | |
raise ArgumentError if to.empty? or from.empty? or subject.empty? or body.empty? | |
message = TMail::Mail.new | |
message.from = from | |
message.to = to | |
message.subject = subject | |
message.content_type = content_type | |
message.body = body | |
yield(message) if block_given? | |
#Postmark.send_through_postmark(message) | |
end | |
private | |
def content_type | |
@content_type ||= 'text/html' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment