ruby-on-rails-3 – Rails 3覆盖Devail Mailer

我正在处理一个紧密地与Mandrill(MailChimp的事务性电子邮件服务)集成在一起的应用程序,并且我试图覆盖Devise Mailer,但是由于某些原因,当我发送API到Mandrill的API调用时,我收到他们的电子邮件,但Devise也给我发电子邮件(这是空白的).

这是我的DeviseMailer

class MyDeviseMailer < Devise::Mailer
  def reset_password_instructions(record)
    mandrill = Mandrill::API.new("#{MandrillConfig.api_key}")
    mandrill.messages 'send-template',{ 
              :template_name => 'Forgot Password',:template_content => "",:message => {
                :subject => "Forgot Password",:from_email => "test@test123.com",:from_name => "Company Support",:to => [
                  {
                    :email => record.email
                  }
                ],:global_merge_vars => [
                  {
                    :name => "FirsT_NAME",:content => record.first_name
                  },{
                    :name => "FORGOT_PASSWORD_URL",:content => "<a href='#{edit_user_password_url(:reset_password_token => record.reset_password_token)}'>Change My Password</a>"
                  }
                ]
              }
            }
      #We need to call super because Devise doesn't think we have sent any mail 
      super
  end
end

超级电话的呼叫在这里找到:http://qnundrum.com/answer.php?q=254917

解决方法

我遇到类似的问题.

您是否更新了devise初始化程序文件(devise.rb)以指定以下内容

config.mailer = "MyDeviseMailer"

您还需要将视图/ devise / mailer中的任何和所有文件移动到views / mydevisemailer.

我也会重新启动你的服务器.

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...