I use rails 3.2.5 ActionMailerto send text messages. Since I have a mailbox:
message_from_user.text.erb:
Hi <%= @recipient.name %>,
You got the following message from <%= @sender.name %>:
<%= @message %>
If @message- "quotes & ampersands", then the text message contains "quotes & ampersands". Thus, it seems that rails simply see this as an HTML representation and avoid any html to prevent cross-site scripting. However, this is plain text mail. The extension .text.erbboth ActionMailerdetects this and sets MIME to text/plain. Therefore, I never want to hide any html.
I have a lot of email templates in my application, all of them are simple. I would like to consider fixing them to include <%=raw @message%>or <%= @message.html_safe %>bad style - not very DRY.
I tried various jobs that included money fixing Erubis. None of them seem to work. I am looking for some patch or config parameter or something to disable escaping html for all files .text.erb.
Any help is much appreciated!
source
share