Sha256: fa47f2610c2b913e9631145154fc428ecd7ca87aeb071c0c2fe4b62251bc2762
Contents?: true
Size: 1.68 KB
Versions: 1
Compression:
Stored size: 1.68 KB
Contents
# frozen_string_literal: true require 'aws-sdk-ses' module Aws module ActionMailer module SES # Provides a delivery method for ActionMailer that uses Amazon Simple Email Service. # # Configure a delivery method with: # # client_options = { region: 'us-west-2' } # ActionMailer::Base.add_delivery_method :ses, Aws::ActionMailer::SESMailer, **client_options # # Client options are used to construct a new Aws::SES::Client instance. # Once you have a delivery method, you can configure your Rails environment to use it: # # config.action_mailer.delivery_method = :ses # # @see https://guides.rubyonrails.org/action_mailer_basics.html class Mailer # @param [Hash] options Passes along initialization options to # [Aws::SES::Client.new](https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/SES/Client.html#initialize-instance_method). def initialize(options = {}) @client = Aws::SES::Client.new(options) @client.config.user_agent_frameworks << 'aws-actionmailer-ses' end # Delivers a Mail::Message object. Called during mail delivery. def deliver!(message) params = { raw_message: { data: message.to_s }, source: message.smtp_envelope_from, # defaults to From header destinations: message.smtp_envelope_to # defaults to destinations (To,Cc,Bcc) } @client.send_raw_email(params).tap do |response| message.header[:ses_message_id] = response.message_id end end # @return [Hash] def settings {} end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aws-actionmailer-ses-0.1.0 | lib/aws/action_mailer/ses/mailer.rb |