Rails Mailer实际上没有发送电子邮件 [英] Rails Mailer is not actually sending emails

查看:88
本文介绍了Rails Mailer实际上没有发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始学习Rails上的ruby,这是我遵循的教程之一:

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

我跟随它到了T,但我的Gmail帐户还没有收到任何东西。假设对ruby的某些更新已经改变了您的工作方式,是否公平?

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?

从网上阅读的所有内容中得出的最佳猜测是,该教程实际上缺少将邮件程序设置为使用smtp设置。

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

这是我的smtp设置:

Here are my smtp settings:

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

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

:port => 587,

:port => 587,

:domain => alexei.herokuapp.com,

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

:user_name => mygmailaccount,

:user_name => "mygmailaccount",

:password => mygmailpassword,

:password => "mygmailpassword",

:authentication =>普通

:authentication => "plain"

:enable_starttls_auto => true
}

:enable_starttls_auto => true }

是否可以在测试时仍在本地环境中?

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

推荐答案

在该Railscast中,Ryan所在的行在开发中不发送任何电子邮件:

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.

尝试删除它。

还要打开myapp / logs / development.log,以查看尝试发送电子邮件时是否显示内容。

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

这篇关于Rails Mailer实际上没有发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆