1

I am using the following with an embedded ruby tag to call the logged in users email address so it will populate the 'to' field when it opens the email client.

<h4 align="center">
  <%= link_to "Click to arrange swap",
    "mailto:#{@article.user.email}", class: "btn btn-xs btn-primary"%>
</h4>

But, I would like to add a subject (article.artist) to the email, and the URL of the page in the body of the email. Anyone any ideas.

Thanks in advance.

mikej
  • 65,295
  • 17
  • 152
  • 131

1 Answers1

6

You can use also ActionView helper mail_to which has additional html_options attributes for subject, body etc.

<%= mail_to @article.user.email, "Click to arrange swap", subject: @article.artist, body: "Your content #{request.original_url}" %>

For more info, you can look up to this link

John Baker
  • 2,315
  • 13
  • 12