Class: Courrier::Email::Providers::Sparkpost

Inherits:
Base
  • Object
show all
Defined in:
lib/courrier/email/providers/sparkpost.rb

Constant Summary collapse

ENDPOINT_URL =
"https://api.sparkpost.com/api/v1/transmissions"

Instance Method Summary collapse

Methods inherited from Base

#deliver, #initialize

Constructor Details

This class inherits a constructor from Courrier::Email::Providers::Base

Instance Method Details

#bodyObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/courrier/email/providers/sparkpost.rb', line 9

def body
  {
    "content" => {
      "reply_to" => @options.reply_to,
      "from" => @options.from,
      "subject" => @options.subject,
      "text" => @options.text,
      "html" => @options.html
    }.compact,
    "recipients" => [
      {
        "address" => {
          "email" => @options.to
        }
      }
    ]
  }
end