Ruby on rails 3 Rails 3邮件拦截器冲突

Ruby on rails 3 Rails 3邮件拦截器冲突,ruby-on-rails-3,actionmailer,conflict,interceptor,mailer,Ruby On Rails 3,Actionmailer,Conflict,Interceptor,Mailer,我遵循了RailsCasts教程(发送电子邮件修订版)。我不得不更改“config”中的开发文件,因为它无法正常工作。当我尝试添加拦截器时(告诉Rails也将电子邮件发送给我),它将停止向用户发送。如果我禁用它,它会将它发送给用户,但不会发送给我。我一点错误都没有。谢谢大家! Here are my files: My config/development.rb file: ActionMailer::Base.smtp_settings = { :address

我遵循了RailsCasts教程(发送电子邮件修订版)。我不得不更改“config”中的开发文件,因为它无法正常工作。当我尝试添加拦截器时(告诉Rails也将电子邮件发送给我),它将停止向用户发送。如果我禁用它,它会将它发送给用户,但不会发送给我。我一点错误都没有。谢谢大家!

Here are my files:
My config/development.rb file:

  ActionMailer::Base.smtp_settings = {
:address              => "smtp.gmail.com",
:port                 => 587,
:user_name            => "admin@gmail.com",
:password             => 'admin',
:authentication       => "plain",
:enable_starttls_auto => true
 } 

User controller:
UserMailer.signup_confirmation(@user).deliver


User mailer file:
app/mailers/user_mailer.rb

class UserMailer < ActionMailer::Base
default from: "admin@gmail.com"

def signup_confirmation(user)
@user = user
mail to: user.email, subject: "Sign Up Confirmation"    
end
end

lib/development_mail_interceptor.rb file

 class DevelopmentMailInterceptor  
  def self.delivering_email(message)  
    message.subject = "[#{message.to}] #{message.subject}"  
    message.to = "admin@gmail.com"  
  end  
end

config/initiliazers/setup_mail.rb

require 'development_mail_interceptor'
ActionMailer::Base.register_interceptor(DevelopmentMailInterceptor) if 
Rails.env.development?        
以下是我的文件:
我的config/development.rb文件:
ActionMailer::Base.smtp\u设置={
:address=>“smtp.gmail.com”,
:端口=>587,
:user_name=>“admin@gmail.com",
:password=>“admin”,
:身份验证=>“普通”,
:enable_starttls_auto=>true
} 
用户控制器:
UserMailer.signup\u确认(@user.deliver)
用户邮件程序文件:
app/mailers/user_mailer.rb
类UserMailer
您正在将电子邮件设置为,而不是添加到其中

message.to = "admin@gmail.com" 
请尝试以下方法之一:

message.to << "admin@gmail.com" 
message.to += "admin@gmail.com" 
message.to