Module: AWS::SES::SendEmail

Included in:
Base
Defined in:
lib/aws/ses/send_email.rb

Overview

Adds functionality for send_email and send_raw_email Use the following to send an e-mail:

ses = AWS::SES::Base.new( ... connection info ... )
ses.send_email :to        => ['[email protected]', '[email protected]'],
             :source    => '[email protected]',
             :subject   => 'Subject Line'
             :text_body => 'Internal text body'

Instance Method Summary collapse

Instance Method Details

#send_email(options = {}) ⇒ Response

Sends an email through SES

the destination parameters can be:

A single e-mail string

[email protected]

A array of e-mail addresses
[email protected]’, ‘[email protected]

“Email address is not verified.MessageRejected (AWS::Error)”

If you are receiving this message and you HAVE verified the [source] please check to be sure you are not in sandbox mode! If you have not been granted production access, you will have to <b>verify all recipients</b as well. docs.amazonwebservices.com/ses/2010-12-01/DeveloperGuide/index.html?InitialSetup.Customer.html


Parameters:

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

    a customizable set of options

Options Hash (options):

  • :source (String)

    Source e-mail (from)

  • :from (String)

    alias for :source

  • :to (String)

    Destination e-mails

  • :cc (String)

    Destination e-mails

  • :bcc (String)

    Destination e-mails

  • :subject (String)
  • :html_body (String)
  • :text_body (String)
  • :return_path (String)

    The email address to which bounce notifications are to be forwarded. If the message cannot be delivered to the recipient, then an error message will be returned from the recipient’s ISP; this message will then be forwarded to the email address specified by the ReturnPath parameter.

  • (Object)

Returns:

  • (Response)

    the response to sending this e-mail



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/aws/ses/send_email.rb', line 39

def send_email(options = {})
  package     = {}
  
  package['Source'] = options[:source] || options[:from]
  
  add_array_to_hash!(package, 'Destination.ToAddresses', options[:to]) if options[:to]
  add_array_to_hash!(package, 'Destination.CcAddresses', options[:cc]) if options[:cc]
  add_array_to_hash!(package, 'Destination.BccAddresses', options[:bcc]) if options[:bcc]
  
  package['Message.Subject.Data'] = options[:subject]
  
  package['Message.Body.Html.Data'] = options[:html_body] if options[:html_body]
  package['Message.Body.Text.Data'] = options[:text_body] || options[:body] if options[:text_body] || options[:body]
  
  package['ReturnPath'] = options[:return_path] if options[:return_path]
  
  request('SendEmail', package)
end