Class: ChainMail::Providers::Postmark

Inherits:
Base
  • Object
show all
Defined in:
lib/chain_mail/providers/postmark.rb

Class Method Summary collapse

Methods inherited from Base

post_json

Class Method Details

.deliver(mail, creds) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/chain_mail/providers/postmark.rb', line 6

def self.deliver(mail, creds)
  payload = {
    From: mail.from.first,
    To: mail.to.join(","),
    Subject: mail.subject,
    HtmlBody: mail.body.decoded
  }
  headers = {
    "X-Postmark-Server-Token" => creds[:api_key],
    "Content-Type" => "application/json"
  }
  post_json("https://api.postmarkapp.com/email", headers, payload)
end