rails:在mail_to链接中包含html

时间:2010-11-19 11:27:28

标签: html ruby-on-rails email mailto

我正在寻找一种在mail_to链接中包含html的方法,以便我可以自动在此电子邮件的正文中包含横幅。

感谢任何提示

马库斯

2 个答案:

答案 0 :(得分:13)

Rails 3

mail_to "email@example.com", raw(image_tag("/path/to/banner.png"))

Rails 2.x

mail_to "email@example.com", image_tag("/path/to/banner.png")

请参阅mail_to帮助程序的文档。

答案 1 :(得分:0)

在使用actionview-encode_mail_to的rails 4中,您可以像(Haml语法)那样执行:

= mail_to 'email@example.com', encode: 'javascript' do
  = image_tag('contact_email.png')