Class: Sendgrid::API::Web::Mail::Services

Inherits:
Service
  • Object
show all
Defined in:
lib/sendgrid/api/web/mail.rb

Instance Attribute Summary

Attributes inherited from Service

#resource

Instance Method Summary collapse

Methods inherited from Service

#initialize, #perform_request

Constructor Details

This class inherits a constructor from Sendgrid::API::Service

Instance Method Details

#send(options = {}) ⇒ Entities::Response

Send email.

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :to (String)

    Must be a valid email address. This can also be passed in as an array, to send to multiple locations.

  • :toname (String)

    Give a name to the recipient. This can also be passed as an array if the to above is an array.

  • :x_smtpapi (String)
  • :subject (String)

    The subject of your email.

  • :text (String)

    The actual content of your email message. It can be sent as either plain text or HTML for the user to display.

  • :html (String)

    The actual content of your email message. It can be sent as either plain text or HTML for the user to display.

  • :from (String)

    This is where the email will appear to originate from for your recipient.

  • :bcc (String)

    This can also be passed in as an array of email addresses for multiple recipients.

  • :fromname (String)

    This is name appended to the from email field.

  • :replyto (String)

    Append a reply-to field to your email message.

  • :date (String)

    Specify the date header of your email.

  • :files (String)

    Files to be attached.

  • :content (String)

    Content IDs of the files to be used as inline images.

  • :headers (String)

    A collection of key/value pairs in JSON format.

Returns:

See Also:



34
35
36
37
# File 'lib/sendgrid/api/web/mail.rb', line 34

def send(options = {})
  options['x-smtpapi'] = options.delete(:x_smtpapi) if options.member?(:x_smtpapi)
  perform_request(Entities::Response, 'mail.send.json', options)
end