mardi 21 juillet 2015

HTML Tags Not Working In Email Rails4

What is the best way to send html formated emails?

I thought 'content = "text/html"' should do the trick but looks like it is not. I am sending email like this:

mail(to: <to_email>, from: <from_email>,  subject: <subject>, content_type: 'text/html')

Text which I want to send includes linebreaks (lb;) and &nbsp(nb;) like:

"Hello <br/> &nbsp; World"

Email which I got is just like that:

"Hello <br/> &nbsp; World"

I would have thought it to come like this:

"Hello
  World"

Make sense?

I think there is one more way(simple_format) to do that but I am not pretty convinced with that.

Aucun commentaire:

Enregistrer un commentaire