Rails Mailer is not actually sending emails

雨燕双飞 提交于 2019-12-11 19:32:15

问题


I have just started learning ruby on rails and this was one of the tutorials i followed:

http://railscasts.com/episodes/206-action-mailer-in-rails-3

I followed it to a T and I have yet to receive anything in my gmail account. Is it fair to assume some updates to ruby have changed how you do things?

My best guess from reading everything over the net, the tutorial is missing actually setting the mailer to use smtp setting.

Here are my smtp settings:

ActionMailer::Base.smtp_settings = { :address => "smtp.gmail.com",

:port => 587,

:domain => "alexei.herokuapp.com",

:user_name => "mygmailaccount",

:password => "mygmailpassword",

:authentication => "plain"

:enable_starttls_auto => true }

Could it be that i am still in local environment when testing this?


回答1:


In that Railscast, Ryan has a line in there that doesn't send any email in development:

Mail.register_interceptor(DevelopmentMailInterceptor) if Rails.env.development?

Did you put that in? If so, then no email will go out when you run your app locally in development.

Try removing it.

Also open myapp/logs/development.log to see if what shows up there when you try to send an email.



来源:https://stackoverflow.com/questions/11216742/rails-mailer-is-not-actually-sending-emails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!