0

I have setup of mailer that is working perfectly. I want to send a link in mail body so in view of mailer i am doing the following:

<%= link_to "somesite","http://www.somesite.com" %>

but in delivered email it appears as following:

<a href="http://www.somesite.com/">somesite</a>

Please let me know if i am missing something. i have already changed the filename message.erb to message.html.erb, but that didn't helped.

geekdeepak
  • 1,165
  • 11
  • 18
  • I know this is an old question, but what behavior were you expecting? You passed two arguments to `#link_to` in the right order: the text you want inside the hyperlink tags and the `href` attribute you're looking for. Rails appears to have generated the appropriate HTML. – Tass May 04 '16 at 20:22

1 Answers1

0

I ran into this a while back. I believe the convention you need to follow for naming your templates is message.text.html.erb. The docs here seem to suggest I'm remembering this right.

The reason for this is that the mime type of the email is inferred from the filename. If you have message.text.plain.erb then ActionMailer should send out a multipart email with a plain text and html portion. You may need to do something extra to make it do that, but I think you don't, if you have both templates.

heartpunk
  • 2,235
  • 1
  • 21
  • 26