##現在の状況
・deviseとAmazon SESを使って登録確認メールを送りたい(まずは開発環境で)
・Amazon SES側ではメールアドレスを有効化しており、そのアドレスを使ってメールを送信する。(下記のコードではinfo@sample.comで記載しています)
・Amazon SES側でSMTPのユーザーネームとパスワードを取得済み(下記のconfig/enveropments/deveropment.rb内にある:user_name、:passwordで使用)
・新規登録画面からsubmitボタンをクリックしてもメールは(hoge@gmailに)送られてこず、別タブで開いているrails serverに下記のSent mailログだけが出力される。
・rails serverのログにあるConfirm my accountのリンクをURL欄に入力するとログイン画面に飛んで、そこでアドレスとパスワードを入力すると登録完了になる。
・Vagrantの仮装開発環境で試している
##問題点
railsアプリでdeviseによるメール認証をしたいのですが、メールが送られてきません。設定は以下のようにしたのですが、何が問題なのでしょうか?
rails
1#rails server時のコンソールログ 2 3Sent mail to hoge@gmail.com (99.5ms) 4Date: Fri, 22 Jul 2016 18:39:39 +0900 5From: info@sample.com 6Reply-To: info@sample.com 7To: hoge@gmail.com 8Message-ID: <5791e9dbd9f2b_2a2a3fa0453b0ec8780ad@localhost.localdomain.mail> 9Subject: Confirmation instructions 10Mime-Version: 1.0 11Content-Type: text/html; 12 charset=UTF-8 13Content-Transfer-Encoding: 7bit 14 15<p>Welcome hoge@gmail.com!</p> 16 17<p>You can confirm your account email through the link below:</p> 18 19<p><a href="http://localhost:3000/users/confirmation?confirmation_token=UNmF3FZLU5to4ocyALy1">Confirm my account</a></p> 20#ここのリンクを直接URLフォームにコピペすると、ログイン画面に飛ばされ、そこでアドレスとパスワードを入力すると登録完了になる 21 22Redirected to http://localhost:3000/ 23Completed 302 Found in 820ms (ActiveRecord: 37.2ms)
rails
1config/enveropments/deveropment.rb 2 3 config.action_mailer.raise_delivery_errors = false 4 config.action_mailer.default_url_options = { :host => 'localhost:3000' } 5 config.action_mailer.delivery_method = :smtp 6 config.action_mailer.smtp_settings = { 7 :address => 'email-smtp.us-east-2.amazonaws.com', 8 :port => 465, 9 :authetication => :login, 10 :user_name => 'AKxxxxxxxxxxxxxx', 11 :domain => "localhost:3000", 12 :password => 'Akxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 13 :ssl => true, 14 :tls => true, 15 :enable_starttls_auto => true, 16 }
rails
1config/initializers/devise.rb 2 3 config.mailer_sender = 'info@sample.com' 4
#ご回答宜しくお願いします!!
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。