所以我试图覆盖'from‘字段,这样它实际上就包含了邀请者的名字,而不是系统默认值。
我已经按照这里的说明做了https://github.com/plataformatec/devise/wiki/How-To:-Use-custom-mailer
我已经设置了我的自定义邮件程序,但我遇到的问题是,与文档中的示例不同,它看起来不像是可以修改的opts对象。
有人有什么建议吗?
class MCDeviseMailer < Devise::Mailer
helper :application # gives access to all helpers defined within `application_helper`.
def invitation_instructions(record)
# opts[:from] = "#{resource.invited_by.full_name rescue "Mission Control"} <notifications@#{DOMAIN}>"
super
end
end非常感谢!
发布于 2014-02-27 11:08:40
你必须对send_devise_notification进行加密。将类似以下内容放入User中
def send_devise_notification(notification, *args)
if :invitation_instructions == notification
args << {
from: "#{inviter_name} <#{inviter_email}>",
}
end
super
end发布于 2015-07-12 03:55:54
https://stackoverflow.com/questions/20838688
复制相似问题