On Wednesday, September 6, 2017 at 6:03:14 AM UTC+1, joel briggs wrote:
>
>
> If I change the Mailer to add the content_type, the attached file becomes 
> a garbled string of text in the email but the HTML tags properly format the 
> text
>
>
>  

> *Mailer*
>
> mail(to: email_params[:to],
>      from: email_params[:from],
>      subject: email_params[:subject],
>      content_type: 'text/html',
>      body: email_params[:body])
>
>
>
If you do this it uses this body option  instead of your template. It looks 
like when you use this form of mail, it will always set the content type of 
the entire message to text/html, which isn't what you want: you want the 
overall message to be a multipart one, and the part derived from the body 
option to be text/html

I would suggest not setting body here at all (or content type). and letting 
it render your template (which I think is what you probably thought it was 
doing at all). You'll need to set @body, as you would with a controller and 
its view

Fred

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/d39c2769-3fa3-4778-bafa-3b64ba60346a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to