rails: include html in a mail_to link
Asked Answered
T

2

7

I'm looking for a way to include html in a mail_to link, so that I can automatically include a banner in the body of this email.

Thanks for any hints

Markus

Trilbi answered 19/11, 2010 at 11:27 Comment(0)
D
13

Rails 3

mail_to "[email protected]", raw(image_tag("/path/to/banner.png"))

Rails 2.x

mail_to "[email protected]", image_tag("/path/to/banner.png")

See the documentation for the mail_to helper.

Danialdaniala answered 19/11, 2010 at 11:36 Comment(3)
What method is raw()? My Rails (2.3.5) doesn't know this method!Trilbi
It's a Rails 3 helper. If you use Rails 2 is even more simple. I updated the response.Danialdaniala
Sorry my question was wrong... But you answered correctly! You can find my real problem here: stackoverflow.com/questions/4224751Trilbi
P
0

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

= mail_to '[email protected]', encode: 'javascript' do
  = image_tag('contact_email.png')
Pederson answered 8/11, 2015 at 20:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.