2011-01-25 13:20:33 -05:00
|
|
|
module Fog
|
|
|
|
module AWS
|
|
|
|
class SES
|
|
|
|
class Real
|
|
|
|
|
|
|
|
require 'fog/aws/parsers/ses/send_raw_email'
|
|
|
|
|
2011-04-12 05:23:01 -04:00
|
|
|
# Send a raw email
|
2011-01-25 13:20:33 -05:00
|
|
|
#
|
|
|
|
# ==== Parameters
|
2011-01-25 20:28:03 -05:00
|
|
|
# * RawMessage <~String> - The message to be sent.
|
|
|
|
# * Options <~Hash>
|
2011-04-12 05:23:01 -04:00
|
|
|
# * Source <~String> - The sender's email address. Takes precenence over Return-Path if specified in RawMessage
|
2011-04-12 05:41:16 -04:00
|
|
|
# * Destinations <~Array> - All destinations for this email.
|
2011-01-25 13:20:33 -05:00
|
|
|
#
|
|
|
|
# ==== Returns
|
|
|
|
# * response<~Excon::Response>:
|
|
|
|
# * body<~Hash>:
|
2011-01-26 20:11:54 -05:00
|
|
|
# * 'MessageId'<~String> - Id of message
|
2011-01-25 13:20:33 -05:00
|
|
|
# * 'ResponseMetadata'<~Hash>:
|
|
|
|
# * 'RequestId'<~String> - Id of request
|
2011-01-25 20:28:03 -05:00
|
|
|
def send_raw_email(raw_message, options = {})
|
|
|
|
params = {}
|
|
|
|
if options.has_key?('Destinations')
|
2011-04-12 05:41:16 -04:00
|
|
|
params.merge!(AWS.indexed_param('Destinations.member', [*options['Destinations']]))
|
2011-01-25 20:28:03 -05:00
|
|
|
end
|
|
|
|
if options.has_key?('Source')
|
|
|
|
params['Source'] = options['Source']
|
|
|
|
end
|
2011-01-25 13:20:33 -05:00
|
|
|
|
|
|
|
request({
|
2011-01-25 20:28:03 -05:00
|
|
|
'Action' => 'SendRawEmail',
|
|
|
|
'RawMessage.Data' => Base64.encode64(raw_message).chomp!,
|
|
|
|
:parser => Fog::Parsers::AWS::SES::SendRawEmail.new
|
2011-01-25 13:20:33 -05:00
|
|
|
}.merge(params))
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|