简体   繁体   中英

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. 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. 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

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

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. But none of of the email popped up in mailcatcher. I did install it under 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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