Using Amazon SES with Rails ActionMailer

2019-01-12 21:27发布

What would be the best way to go about making ActionMailer send mail via Amazon SES in Rails 3?

Edit:

This is now a gem:

gem install amazon-ses-mailer

https://rubygems.org/gems/amazon-ses-mailer

https://github.com/abronte/Amazon-SES-Mailer

10条回答
霸刀☆藐视天下
2楼-- · 2019-01-12 22:00

You can provide delivery method to action mailer in your environment.

config.action_mailer.delivery_method = AmazonSES.deliver

For now you are likely on your own writing the delivery code.

查看更多
Rolldiameter
3楼-- · 2019-01-12 22:04

using :sendmail, I managed to get all emails to send running apt-get install postfix as root on my AWS machine and using all the default answers.

查看更多
Lonely孤独者°
4楼-- · 2019-01-12 22:05

I also have a gem out that supports sending e-mail through SES from Rails 3:

https://github.com/drewblas/aws-ses

It also has all the API for verifying/managing e-mail addresses

查看更多
地球回转人心会变
5楼-- · 2019-01-12 22:07

Configuring your Rails application with Amazon SES

set action_mailer.perform_deliveries to true as it is set to false by default in the development/production environment

config.action_mailer.perform_deliveries = true

then paste this code in your development/production environment

config.action_mailer.smtp_settings = {
  :address => ENV["SES_SMTP_ADDRESS"],
  :port => 587,
  :user_name => ENV["SES_SMTP_USERNAME"], 
  :password => ENV["SES_SMTP_PASSWORD"],
  :authentication => :login,
  :enable_starttls_auto => true
}
查看更多
登录 后发表回答