Reputation: 1799
I am unsure how to add a link to the body of mail_to.
i would like to make @social.title (BGF Ventures: the truth about fundraising) a link, so when clicked the user is directed to the page of the event/social.
Is this possible? if so, could one advise me how
i have the below code:
<span>
<%= mail_to '', '', class: "fa fa-envelope",
subject: "#{@social.title}",
body: "Hi, would like to invite you to the social '#{@social.title}'" %>
</span>
Upvotes: 1
Views: 1132
Reputation: 11137
Its not something Rails can handle if its not handled from javascript in the first place, as this helper will be translated to HTML (some of helpers with javascript support) so Short answer No, you can't
Check also: This answer
Section 2 of RFC 2368 says that the body
field is supposed to be in text/plain
format, so you can't do HTML.
However even if you use plain text it's possible that some modern mail clients would render the resulting link as a clickable link anyway, though.
Upvotes: 2
Reputation: 23859
In general, no, you cannot add an anchor in mailto:
's body
. But I suggest to read this URL, especially the section with title html mailto forms. If you can somehow generate the form, that can do the trick.
Alternatively, you can add a full link (the one which starts with http(s)) to the body, and many of today's email client will detect it and make it clickable.
Upvotes: 1
Reputation: 7878
With mail_to link this seems to be impossible for most mail clients(read my comment). Do you have to use a mail_to link? (this opens the user's default mailbox which may or may not be what you need). If not, you can generate this email on the server side and that way you will have full control (and will be able to put that link among other things).
Upvotes: 1