Button_ to remove an authorization token

I use this code to allow a user to send mail to another user:

<%= button_to("Contact me","mailto:#{@formation.usr.email}?subject=#{@formation.name}", class: "fiche__detail__contact") %>

Which gives me the following html:

<form action="mailto:user@gmail.com?subject=SomeName" class="button_to" method="post">
    <div>
        <input class="fiche__detail__contact" type="submit" value="Me contacter" />
        <input name="authenticity_token" type="hidden" value="cO0XDBcG4j0IfmDJV56sdYSfoLeV9NmhTd+bJu/ku+U=" />
    </div>
</form>

And this king of email:

enter image description here

I tried to set the mail body using &body, but this will not work. In addition, the installation :authenticity_token => falsealso does not work.

How to remove a token?

+4
source share
1 answer

Just use mail_to :

<%= mail_to @formation.usr.email, "Contact me", :subject => @formation.name, class: "fiche__detail__contact" %>
+2
source

Source: https://habr.com/ru/post/1584443/


All Articles