rails: include html in a mail_to link

徘徊边缘 提交于 2019-12-05 04:49: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")

See the documentation for the mail_to helper.

In rails 4 with actionview-encode_mail_to you can do it like (Haml Syntax):

= mail_to 'email@example.com', encode: 'javascript' do
  = image_tag('contact_email.png')
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!