【发布时间】:2013-09-30 18:03:15
【问题描述】:
我正在运行 Rails 应用程序并使用 Mailcather gem 作为 SMTP 服务。据说它可以捕获所有传出的电子邮件,但是我已经在 config/environments/development.rb 中进行了正确的设置,测试它以发送电子邮件,但是在 127.0.0.1:1080 和 localhost:1080 中都没有捕获到电子邮件。但是电子邮件已发送和接收。我已经尝试了所有可能的配置。这是我的 config/development.rb
config/development.rb
Ror::Application.configure do
# Mailer
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_url_options = { :host => '127.0.0.1:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { :address => "127.0.0.1", :port => 1025 }
end
这是我的 user_mailer.rb
class UserMailer < ActionMailer::Base
default :from => "aaaaaaaaa@gmail.com"
def registration_confirmation(user)
@user = user
mail(:to => user.email, :subject => "Registered")
end
end
我使用了 registration_confirmation() 方法来检查用户是否通过电子邮件注册。但是没有一封邮件在 mailcatcher 中弹出。我确实在rvm下安装了它。我确实测试了使用包装器和不使用包装器安装它,但结果仍然相同。底线是,它可以在外面发送电子邮件,但不能在里面接收电子邮件。或任何通知。我错过了什么?任何建议或更正将不胜感激。谢谢
【问题讨论】:
标签: ruby-on-rails ruby ruby-on-rails-3 email smtp