Class: T::Mailer::Api::AwsSes
- Inherits:
-
Object
- Object
- T::Mailer::Api::AwsSes
- Includes:
- Helper
- Defined in:
- lib/t/mailer/api/aws_ses.rb
Instance Attribute Summary collapse
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
Instance Method Summary collapse
-
#client ⇒ Object
Creates a client which will connect to server via API.
-
#initialize(options) ⇒ AwsSes
constructor
Set settings and check if the required credentials are exist.
-
#send_raw_email(params = {}) ⇒ Object
Composes an email message and immediately queues it for sending.
Methods included from Helper
#check_api_defined, #check_settings, #check_version_of, #field_value, #get_value_from, #using_gem
Constructor Details
#initialize(options) ⇒ AwsSes
Set settings and check if the required credentials are exist. If the credentials are missing then it will raise error.
15 16 17 18 19 20 |
# File 'lib/t/mailer/api/aws_ses.rb', line 15 def initialize() @settings = check_settings(:aws_access_key_id, :aws_default_region, :aws_secret_access_key) end |
Instance Attribute Details
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
9 10 11 |
# File 'lib/t/mailer/api/aws_ses.rb', line 9 def settings @settings end |
Instance Method Details
#client ⇒ Object
Creates a client which will connect to server via API
23 24 25 26 27 28 29 |
# File 'lib/t/mailer/api/aws_ses.rb', line 23 def client credentials = Aws::Credentials.new(settings[:aws_access_key_id], settings[:aws_secret_access_key]) region = settings[:aws_default_region] Aws::SES::Client.new(credentials: credentials, region: region) end |
#send_raw_email(params = {}) ⇒ Object
Composes an email message and immediately queues it for sending. When calling this operation, you may specify the message headers as well as the content. The ‘SendRawEmail` operation is particularly useful for sending multipart MIME emails (such as those that contain both a plain-text and an HTML version).
96 97 98 |
# File 'lib/t/mailer/api/aws_ses.rb', line 96 def send_raw_email(params = {}) client.send_raw_email(params) end |