Sha256: a8e5705ee14141ff68c4834251aba84f5a34b68b2945267b1524915b4178fb59
Contents?: true
Size: 762 Bytes
Versions: 2
Compression:
Stored size: 762 Bytes
Contents
module HttpMailer class Client attr_reader :configuration, :mailgun, :sendgrid, :mandrill def initialize(settings) configure(settings) end def configure(settings) @mailgun = MailgunServiceHandler.new(settings[:mailgun]) @sendgrid = SendGridServiceHandler.new(settings[:sendgrid]) @mandrill = MandrillServiceHandler.new(settings[:mandrill]) end def send_message(from, to, subject, body, from_name='', to_name='') response = nil [sendgrid, mailgun, mandrill].each do |service| if service.configured? response = service.send_message(from, to, subject, body, to_name, from_name) break if response.code == 200 end end return response end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
http_mailer-0.0.5 | lib/http_mailer/client.rb |
http_mailer-0.0.4 | lib/http_mailer/client.rb |