Action Mailerを使いメール送信を考えているのですが上手くいきません。
といいますかエラーは無いと思うのですがメールが送信も受信も出来ていない状況です。
何が原因と考えられますでしょうか?
gmailを使いメール送信をしたいと考えております。
送信情報など
メール送信先 $$$$$$$$$@yahoo.co.jp
############@gmail.comのアカウント使用。
以下にてmailerを作成。
rails g mailer message hello
meilersフォルダ mailers/message.rb
ruby
1class Message < ApplicationMailer 2 3default to: $$$$$$$$$@yahoo.co.jp" 4 def hello 5 @greeting = "Hi hogehoge" 6 mail( 7 subject: 'Mail from Message' 8 ) do |format| 9 format.text 10 end 11 12 end 13end
メールテンプレート views/message/hello.text.erb
Message#hello <%= @greeting %>, find me in app/views/message/hello.text.erb
config/environments/development.rbにgmailの内容を設定しています。
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :enable_starttls_auto => true, :address => "smtp.gmail.com", :port => 587, :domain => 'smtp.gmail.com', :user_name => "############@gmail.com", #ご自身のgmailアドレス :password => "&&&&&&&&&&&", #gmailアドレスのパスワード :authentication => 'plain', :authentication => 'login', }
エラーも確認出来る様に以下も変更済み。
config.action_mailer.raise_delivery_errors = true
rails cにて実行
pry(main)>Message.hello.deliver_now Rendered message/hello.text.erb within layouts/mailer (0.5ms) Message#hello: processed outbound mail in 18.7ms Sent mail to $$$$$$$$$@yahoo.co.jp (12.3ms) Date: Sat, 19 Dec 2015 01:49:39 +0900 From: ############@gmail.com To: $$$$$$$$$@yahoo.co.jp Message-ID: <000000000000000@MacBook-Pro.local.mail> Subject: Mail from Message Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 hogehogehogehgoehogehogehogehgoehogehogehoge
エラーなく送信されているような気がするのですが、$$$$$$$$$@yahoo.co.jpには届いていません。
迷惑フォルダにも入っていません。
'############@gmail.comにも送信履歴が御座いません。
googleアカウントへのログインの問題かなーと考えアプリ個別のパスワード作成し、設定もしましたが変わらずです。。。
ここを確認すると良いなど御座いましたらご指摘頂けると幸いです。
宜しくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。