0

I am able to send emails successfully using aws-ses gem but I wanted to add configuration set while sending email. Below are my configurations. Help me in adding configuration set.

Gem which I am using

gem "aws-ses", git: "https://github.com/zebitex/aws-ses.git", ref: "78-sigv4-problem"

config/initializers/amazon_ses.rb

ActionMailer::Base.add_delivery_method :ses, AWS::SES::Base,
access_key_id: "abc",
secret_access_key: "pqr",
signature_version: 4

Thank you for the help

skamall
  • 51
  • 7

1 Answers1

1

you can use the following config

# add these gems to Gemfile
gem 'aws-sdk-rails', '>= 2.1.0'
gem 'aws-sdk-sesv2'

then create initializer file: config/initializers/ses_aws.rb

  creds = Aws::Credentials.new(aws_access_key_id, aws_secret_key)

  Aws::Rails.add_action_mailer_delivery_method(
    :ses,
    credentials: creds,
    region: 'ap-southeast-1' # or any region
  )

update config file config/environments/production.rb (you can update your development.rb too for testing)

    config.action_mailer.delivery_method = :ses

you can send emails like normally, for example: UserMailer.send_confirmation_email(user_id).deliver

Saiqul Haq
  • 2,287
  • 16
  • 18
  • configuration set is a group of rules which we can add to email header using Amazon SES. Is there a way to add configuration set using these gems? so that for each email sent we can set configuration set in the header @SaiqulHaq – skamall Aug 31 '21 at 13:05
  • I didn't add any configuration set on my app. it just works – Saiqul Haq Aug 31 '21 at 13:46
  • configuration set is an optional parameter to specify a set of rules and event destinations in Amazon SES. But not sure on how to add config set with these gems – skamall Sep 02 '21 at 05:12