Ruby on Rails 3.2.5 にて、Amazon SES (Simple Email Service)を使ってメール送信ができるようにする設定方法をメモ。
■ config/environments/production.rb
# Amazon SES
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { host: 'your-domain.example.com' }
config.action_mailer.raise_delivery_errors = true
config.action_mailer.smtp_settings = {
:address => "email-smtp.us-east-1.amazonaws.com",
:port => 465,
:domain => 'your-domain.example.com',
:user_name => 'XXXXXXXXXXXXXXXXXX',
:password => 'SGNIHinBVUSHLGHVIUSHIRHIIHFIL',
:authentication => :plain
}
■ config/initializers/amazon_ses.rb
module Net
class SMTP
def tls?
true
end
end
end
■ Gemfile
# Amazon SES
gem "aws-ses", "~> 0.4.4", :require => 'aws/ses'
以上です。
【参考】
・Amazon SES SMTP Emails using Rails 3.1 in Three Easy Steps | | ReadyPulse BlogReadyPulse Blog
・EOFError error trying to use Amazon SES via SMTP with Rails 3.1.3 - Stack Overflow
・Amazon SES(Simple Email Service)でメールを送ってみなイカ? | Pocketstudio.jp log3
・Amazon SESでメールを送ったときにGmailでvia email-bounces.amazonses.comって表示されないようにする - Startup Reality
・Amazon’s Simple Email Service on rails using aws-ses and devise - Tee Parham’s posterous