我正在开发一个与 Mandrill(MailChimp 的事务性电子邮件服务)紧密集成的应用程序,我正在尝试覆盖 Devise Mailer,但由于某种原因,当我向 Mandrill 发送 API 调用时,我收到了他们的电子邮件,但也设计了给我发一封电子邮件(空白)。
这是我的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
super
我在这里找到的电话:http://qnundrum.com/answer.php?q= 254917