Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using mail_to with a block (mail_to ... do)

I would like to do the following to insert a styled mail_to:

<%= mail_to @colleague.email do %>
  <span class="email" id="colleague_40"> Reply by Email </span>
<% end %>

The RoR docs aren't specific on the topic of mail_to blocks but the above code doesn't seem to work. Is there a way to do a block in conjunction with mail_to?

like image 417
sscirrus Avatar asked Dec 30 '25 11:12

sscirrus


1 Answers

<% mail_content = capture do %>
    <span class="email" id="colleague_40"> Reply by Email </span>
<% end %>

<%= mail_to @colleague.email, mail_content %>
like image 83
Arun Kumar Arjunan Avatar answered Jan 02 '26 02:01

Arun Kumar Arjunan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!