Class: Courrier::Email::Providers::Sendgrid

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

Constant Summary collapse

ENDPOINT_URL =
"https://api.sendgrid.com/v3/mail/send"

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
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/courrier/email/providers/sendgrid.rb', line 9

def body
  {
    "from" => {
      "email" => @options.from
    },
    "personalizations" => [
      {
        "to" => [
          {
            "email" => @options.to
          }
        ]
      }
    ],
    "reply_to" => reply_to_object,

    "subject" => @options.subject,
    "content" => [
      {
        "type" => "text/plain",
        "value" => @options.text
      },
      {
        "type" => "text/html",
        "value" => @options.html
      }
    ].compact
  }.compact
end