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 14:50:21 -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-06-20 16:49:37 -04:00
|
|
|
params.merge!(Fog::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',
|
2013-07-03 23:00:48 -04:00
|
|
|
'RawMessage.Data' => Base64.encode64(raw_message.to_s).chomp!,
|
2011-01-25 20:28:03 -05:00
|
|
|
:parser => Fog::Parsers::AWS::SES::SendRawEmail.new
|
2011-01-25 13:20:33 -05:00
|
|
|
}.merge(params))
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|