Using Amazon SES with Rails ActionMailer

前端 未结 10 1409
南旧
南旧 2020-12-04 09:42

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-         


        
10条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-04 10:13

    For TLS SSL setup [Recommended by Amazon SES]

    Spoiler Alert: NO GEM Required

    smtp is defualt way of sending email in rails but you can add this line to explicitly define in config/application.rb file

    config.action_mailer.delivery_method = :smtp
    

    In config/application.rb or you can specify in certain environment file

    config.action_mailer.smtp_settings = {
        address: 'Amazon SES SMTP HOSTNAME',
        port: 465,   #TLS port
        domain: 'example.com',
        user_name: 'SMTP_USERNAME',
        password: 'SMTP_PASSWORD',
        authentication: 'plain',   #you can also use login
        ssl: true,   #For TLS SSL connection
    }
    

    The Amazon SES SMTP HOSTNAME is specific for every region, so you that name which you are in, following are hostnames wrt regions.

    1. email-smtp.us-east-1.amazonaws.com (for region us-east-1)
    2. email-smtp.us-west-2.amazonaws.com (for region us-west-2)
    3. email-smtp.eu-west-1.amazonaws.com (for region eu-west-1)

    StackOverFlow | Amazon-getting-started-send-using-smtp

提交回复
热议问题