简体   繁体   English

mailcatcher中没有电子邮件提醒,但能够将电子邮件发送到有效帐户?

[英]No email alerts in mailcatcher, but able to send emails to valid account?

I am running a Rails app and using Mailcather gem as an SMTP service. 我正在运行Rails应用程序并使用Mailcather gem作为SMTP服务。 It was said that it can catch all outgoing emails, however I've done making correct settings in config/environments/development.rb, testing it to send email, but no email catched in either 127.0.0.1:1080 and localhost:1080. 据说它可以捕获所有传出的电子邮件,但是我已经在config / environments / development.rb中进行了正确的设置,测试它以发送电子邮件,但127.0.0.1:1080和localhost:1080都没有收到电子邮件。 But the email was sent and received tho. 但是电子邮件是发送和接收的。 I've tried all of the possible configurations. 我已经尝试了所有可能的配置。 Here is my config/development.rb 这是我的config / development.rb

config/development.rb 配置/ 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

Here is my user_mailer.rb 这是我的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

I used the registration_confirmation() method to check whether user is registered or not via email. 我使用了registration_confirmation()方法来检查用户是否通过电子邮件注册。 But none of of the email popped up in mailcatcher. 但邮件中没有任何邮件弹出。 I did install it under rvm. 我确实在rvm下安装了它。 I did test install it both with wrapper and without wrapper but the result still the same. 我用包装器和没有包装器进行了测试安装,但结果仍然相同。 Bottom line is, it is able to send emails outside, but can't receive email inside. 最重要的是,它能够在外面发送电子邮件,但不能在里面接收电子邮件。 Or any notifications. 或任何通知。 Did I miss something? 我错过了什么? Any advice or corrections would be appreciated. 任何建议或更正将不胜感激。 Thanks 谢谢

你调用这样的邮件方法:

UserMailer.registration_confirmation(user).deliver

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM