Deviceでメール送信設定(SESだよ(°_°))
Deviceでメール送信の設定の忘備録
メールが送れない問題の原因は、ちゃんと設定されてなかったからでした(笑)
忘れないようにメモしておきます( *`ω´)
初投稿だよっw
(間違えた記述がある場合は優しく教えていただけますと幸いです..)
1. config/environments/development.rbの下記をコメントアウトにする。
#config.action_mailer.raise_delivery_errors = false
2.SESでメール認証
config/initializers/devise.rbのconfig.mailer_senderを、
SES に登録されているメールアドレスに書き換えます。
config.mailer_sender = 'sample@xxx.com'
config/environment/development.rbに下記を記述。
config.action_mailer.default_url_options = { :host => 'サーバーの値' } config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :address => 'email-smtp.us-east-1.amazonaws.com', :port => 587, :authetication => :login, :user_name => 'xxxxxxxxxxxxxxx', :domain => "sample.com", :password => 'xxxxxxxxxxxxxxx', :enable_starttls_auto => true, }
user_name と passwordは SESのコンソールで取得しましょう。
参考 URL:
これでデプロイしたら、無事動きました!!
config/environment/development.rbに直接、SMTP情報書き込むのってどうなのってところもありますが…
後々良い方法学んだら書き換えます。。