Composing HTML e-mail with a PDF attachment


#1

Hi, everyone. I’ve been using Rails for a little while now, and am
really, really enjoying the experience.

I’m having the darndest time trying to send e-mail whose contents are in
HTML, and which includes a PDF attachment. Following various
instructions (in the Pragmatic book, as well as at
http://wiki.rubyonrails.com/rails/pages/HowToSendEmailsWithActionMailer),
I’m able to send HTML e-mail or a PDF attachment (generated from
pdf/writer). But I can’t figure out how to use an .rhtml template to
generate the HTML, and then attach a PDF file to it. I’ve thought about
rendering a separate template from the one with the same name as my
ActionMailer subclass, but it seems a bit roundabout to define two
different methods to send one e-mail message.

I’ve tried the suggestions at
http://wiki.rubyonrails.com/rails/pages/HowToSendMimeMultipartEmailsWithActionMailer,
but to no avail.

Does anyone have a simple solution to this problem?

Thanks in advance,

Reuven


#2

Hi Reuven,
which way do you send the email? Using the raw TMail object as described
in the HowToSendMimeMultipartEmailsWithActionMailer? Can you post some
code?

Thanks

Peter