gpt4 book ai didi

ruby-on-rails-3 - 设计重置密码的邮件模板

转载 作者:行者123 更新时间:2023-12-03 00:42:44 25 4
gpt4 key购买 nike

我想在通过设计重置密码时发送的电子邮件中添加附件( Logo 图像),并且我想使用用户的区域设置来本地化电子邮件文本。任何人都可以帮助并告诉我要覆盖什么才能做到这一点吗?

最佳答案

您需要将 Logo 图像添加为附件。

为此,请按照链接中的说明覆盖默认的 Devise::Mailer: https://github.com/plataformatec/devise/wiki/How-To:-Use-custom-mailer

然后,使用 attachments.inline['logo.png']= 添加附件:

def reset_password_instructions(record, opts={})
attachments.inline['logo.png'] = File.read('app/assets/images/logo.png')
super(record, opts)
end

在 View 中您可以使用attachments['logo.png'].url:

<%= image_tag(attachments['logo.png'].url, alt: 'Logo') %>

关于ruby-on-rails-3 - 设计重置密码的邮件模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10143118/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com