我正在尝试在 Rails 4 中制作一个应用程序。
在过去的三年里,我一直在努力弄清楚 devise/omniauth (我仍在努力让它发挥作用)。
当我尝试找到度过这一切的意愿时,抛开主要问题,我尝试使用 Mandrill 设置电子邮件。
我找到了这个教程,我正在尝试遵循该教程:https://nvisium.com/blog/2014/10/08/mandrill-devise-and-mailchimp-templates/ https://nvisium.com/blog/2014/10/08/mandrill-devise-and-mailchimp-templates/
我有一个名为 mandrill_devise_mailer.rb 的邮件程序
class MandrillDeviseMailer < Devise::Mailer
def confirmation_instructions(record, token, opts={})
# code to be added here later
end
def reset_password_instructions(record, token, opts={})
options = {
:subject => "Reset your password",
:email => record.email,
:global_merge_vars => [
{
name: "password_reset_link",
# content: "http://www.example.com/users/password/edit?reset_password_token=#{token}"
content: "http://www.cr.com/users/password/edit?reset_password_token=#{token}"
},
{
name: "PASSWORD_RESET_REQUEST_FROM",
content: record.full_name
}
],
:template => "Forgot Password"
}
mandrill_send options
end
def unlock_instructions(record, token, opts={})
# code to be added here later
end
def mandrill_send(opts={})
message = {
:subject=> "#{opts[:subject]}",
:from_name=> "Reset Instructions",
# :from_email=>"[email protected] /cdn-cgi/l/email-protection",
:from_email=>["PROD_WELCOME"],
:to=>
[{"name"=>"#{opts[:full_name]}",
"email"=>"#{opts[:email]}",
"type"=>"to"}],
:global_merge_vars => opts[:global_merge_vars]
}
sending = MANDRILL.messages.send_template opts[:template], [], message
rescue Mandrill::Error => e
Rails.logger.debug("#{e.class}: #{e.message}")
raise
end
end
上述内容与他们在教程中所做的内容之间的区别是:
在我的 mailchimp mandrill 模板中,我有:
<a href="*|password_reset_link|*">Change my password </a>
当我收到重置说明的电子邮件时,我会收到一个带有下划线的更改密码表单链接,上面写着“更改旁边的密码”。我想“将我的密码更改为隐藏链接文本的标签”。
谁能看到我做错了什么吗?