Class: Fog::AWS::SES::Real
- Inherits:
-
Object
- Object
- Fog::AWS::SES::Real
- Defined in:
- lib/fog/aws/ses.rb,
lib/fog/aws/requests/ses/send_email.rb,
lib/fog/aws/requests/ses/get_send_quota.rb,
lib/fog/aws/requests/ses/send_raw_email.rb,
lib/fog/aws/requests/ses/get_send_statistics.rb,
lib/fog/aws/requests/ses/verify_email_address.rb,
lib/fog/aws/requests/ses/delete_verified_email_address.rb,
lib/fog/aws/requests/ses/list_verified_email_addresses.rb
Instance Method Summary collapse
-
#delete_verified_email_address(email_address) ⇒ Object
Delete an existing verified email address.
-
#get_send_quota ⇒ Object
Returns the user’s current activity limits.
-
#get_send_statistics ⇒ Object
Returns the user’s current activity limits.
-
#initialize(options = {}) ⇒ Real
constructor
Initialize connection to SES.
-
#list_verified_email_addresses ⇒ Object
Returns a list containing all of the email addresses that have been verified.
- #reload ⇒ Object
-
#send_email ⇒ Object
Delete an existing verified email address.
-
#send_raw_email ⇒ Object
Delete an existing verified email address.
-
#verify_email_address(email_address) ⇒ Object
Verifies an email address.
Constructor Details
#initialize(options = {}) ⇒ Real
Initialize connection to SES
Notes
options parameter must include values for :aws_access_key_id and :aws_secret_access_key in order to create a connection
Examples
ses = SES.new(
:aws_access_key_id => your_aws_access_key_id,
:aws_secret_access_key => your_aws_secret_access_key
)
Parameters
-
options<~Hash> - config arguments for connection. Defaults to {}.
-
region<~String> - optional region to use, in [‘eu-west-1’, ‘us-east-1’, ‘us-west-1’i, ‘ap-southeast-1’]
-
Returns
-
SES object with connection to AWS.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/fog/aws/ses.rb', line 44 def initialize(={}) @aws_access_key_id = [:aws_access_key_id] @aws_secret_access_key = [:aws_secret_access_key] @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key) [:region] ||= 'us-east-1' @host = [:host] || case [:region] when 'us-east-1' 'email.us-east-1.amazonaws.com' else raise ArgumentError, "Unknown region: #{[:region].inspect}" end @path = [:path] || '/' @port = [:port] || 443 @scheme = [:scheme] || 'https' @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", [:persistent]) end |
Instance Method Details
#delete_verified_email_address(email_address) ⇒ Object
Delete an existing verified email address
Parameters
-
email_address<~String> - Email Address to be removed
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘DeleteVerfiedEmailAddressResponse’<~nil>
-
‘ResponseMetadata’<~Hash>:
-
‘RequestId’<~String> - Id of request
-
-
-
18 19 20 21 22 23 24 |
# File 'lib/fog/aws/requests/ses/delete_verified_email_address.rb', line 18 def delete_verified_email_address(email_address) request({ 'Action' => 'DeleteVerifiedEmailAddress', 'EmailAddress' => email_address, :parser => Fog::Parsers::AWS::SES::DeleteVerifiedEmailAddress.new }) end |
#get_send_quota ⇒ Object
Returns the user’s current activity limits.
Parameters
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘GetSendQuotaResult’<~Hash>
-
‘Max24HourSend’ <~String>
-
‘MaxSendRate’ <~String>
-
‘SentLast24Hours’ <~String>
-
-
‘ResponseMetadata’<~Hash>:
-
‘RequestId’<~String> - Id of request
-
-
-
21 22 23 24 25 26 |
# File 'lib/fog/aws/requests/ses/get_send_quota.rb', line 21 def get_send_quota request({ 'Action' => 'GetSendQuota', :parser => Fog::Parsers::AWS::SES::GetSendQuota.new }) end |
#get_send_statistics ⇒ Object
Returns the user’s current activity limits.
Parameters
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘GetSendStatisticsResult’<~Hash>
-
‘SendDataPoints’ <~Array>
-
‘Bounces’ <~String>
-
‘Complaints’ <~String>
-
‘DeliveryAttempts’ <~String>
-
‘Rejects’ <~String>
-
‘Timestamp’ <~String>
-
-
-
‘ResponseMetadata’<~Hash>:
-
‘RequestId’<~String> - Id of request
-
-
-
24 25 26 27 28 29 |
# File 'lib/fog/aws/requests/ses/get_send_statistics.rb', line 24 def get_send_statistics request({ 'Action' => 'GetSendStatistics', :parser => Fog::Parsers::AWS::SES::GetSendStatistics.new }) end |
#list_verified_email_addresses ⇒ Object
Returns a list containing all of the email addresses that have been verified
Parameters
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘ListVerifiedEmailAddressesResult’<~Hash>
-
‘VerifiedEmailAddresses’ <~Array>
-
-
‘ResponseMetadata’<~Hash>:
-
‘RequestId’<~String> - Id of request
-
-
-
19 20 21 22 23 24 |
# File 'lib/fog/aws/requests/ses/list_verified_email_addresses.rb', line 19 def list_verified_email_addresses request({ 'Action' => 'ListVerifiedEmailAddresses', :parser => Fog::Parsers::AWS::SES::ListVerifiedEmailAddresses.new }) end |
#reload ⇒ Object
61 62 63 |
# File 'lib/fog/aws/ses.rb', line 61 def reload @connection.reset end |
#send_email ⇒ Object
Delete an existing verified email address
Parameters
-
Destination <~Hash> - The destination for this email, composed of To:, From:, and CC: fields.
-
BccAddresses <~Array> - The BCC: field(s) of the message.
-
CcAddresses <~Array> - The CC: field(s) of the message.
-
ToAddresses <~Array> - The To: field(s) of the message.
-
-
Message <~Hash> - The message to be sent.
-
Body <~Hash>
-
Html <~Hash>
-
Charset <~String>
-
Data <~String>
-
-
Text <~Hash>
-
Charset <~String>
-
Data <~String>
-
-
-
Subject <~Hash>
-
Charset <~String>
-
Data <~String>
-
-
-
ReplyToAddresses <~Array> - The reply-to email address(es) for the message. If the recipient replies to the message, each reply-to address will receive the reply.
-
ReturnPath <~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.
-
Source <~String> - The sender’s email address
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘DeleteVerfiedEmailAddressResponse’<~nil>
-
‘ResponseMetadata’<~Hash>:
-
‘RequestId’<~String> - Id of request
-
-
-
36 37 38 39 40 41 42 43 44 |
# File 'lib/fog/aws/requests/ses/send_email.rb', line 36 def send_email() params = AWS.indexed_param('ReplyToAddresses.member', [*reply_to_addresses]) request({ 'Action' => 'DeleteVerifiedEmailAddress', 'EmailAddress' => email_address, :parser => Fog::Parsers::AWS::SES::DeleteVerifiedEmailAddress.new }.merge(params)) end |
#send_raw_email ⇒ Object
Delete an existing verified email address
Parameters
-
Destinations <~Array> - The destination for this email, composed of To:, From:, and CC: fields.
-
RawMessage <~Hash> - The message to be sent.
-
Data <~String>
-
-
Source <~String> - The sender’s email address
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘DeleteVerfiedEmailAddressResponse’<~nil>
-
‘ResponseMetadata’<~Hash>:
-
‘RequestId’<~String> - Id of request
-
-
-
22 23 24 25 26 27 28 29 30 |
# File 'lib/fog/aws/requests/ses/send_raw_email.rb', line 22 def send_raw_email() # TODO: Make this work params = AWS.indexed_param('ReplyToAddresses.member', [*reply_to_addresses]) request({ 'Action' => 'SendRawEmail', :parser => Fog::Parsers::AWS::SES::SendRawEmail.new }.merge(params)) end |
#verify_email_address(email_address) ⇒ Object
Verifies an email address. This action causes a confirmation email message to be sent to the specified address.
Parameters
-
email_address<~String> - The email address to be verified
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘VerifyEmailAddressResult’<~nil>
-
‘ResponseMetadata’<~Hash>:
-
‘RequestId’<~String> - Id of request
-
-
-
18 19 20 21 22 23 24 |
# File 'lib/fog/aws/requests/ses/verify_email_address.rb', line 18 def verify_email_address(email_address) request({ 'Action' => 'VerifyEmailAddress', 'EmailAddress' => email_address, :parser => Fog::Parsers::AWS::SES::VerifyEmailAddress.new }) end |