【问题标题】:Rails Mailer is not actually sending emailsRails Mailer 实际上并没有发送电子邮件
【发布时间】:2012-06-28 07:49:52
【问题描述】:

我刚刚开始学习 ruby​​ on rails,这是我遵循的教程之一:

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

我关注了它,但我的 gmail 帐户还没有收到任何东西。假设 ruby​​ 的一些更新改变了你做事的方式是否公平?

我最好的猜测是通过网络阅读所有内容,该教程实际上缺少将邮件程序设置为使用 smtp 设置。

这是我的 smtp 设置:

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

:端口 => 587,

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

:user_name => "mygmailaccount",

:password => "mygmailpassword",

:authentication => "普通"

:enable_starttls_auto => 真 }

会不会是我在测试时还在本地环境中?

【问题讨论】:

  • Rails 日志中有错误吗?

标签: ruby-on-rails email smtp gmail actionmailer


【解决方案1】:

在那次 Railscast 中,Ryan 有一行在开发中不发送任何电子邮件:

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

你把它放进去了吗?如果是这样,那么当您在本地开发中运行应用程序时不会发送任何电子邮件。

尝试删除它。

同时打开 myapp/logs/development.log 以查看当您尝试发送电子邮件时是否会出现。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-05-21
    • 2015-06-25
    • 2015-08-23
    • 2019-10-29
    • 2015-07-25
    • 2021-01-22
    • 1970-01-01
    • 2016-05-12
    相关资源
    最近更新 更多