Attaching files to emails using ActionMailer

Hey Guys,

I wish to generate a PDF on the fly to attach to an email. I am using action mailer and I want to tell the action mailer to attach a PDF from a URL not a file. All of the examples I have seen attach the file to the email like so...

      attachment :content_type => "image/jpeg",         :body => File.read("an-image.jpg")

Is there anyway I can make it so that "an-image.jpg" is called from a url on the localhost so something like "localhost/invoice.pdf". This will fit in to my rails app as it generates a PDF using prawn and prawnto from that url.

Thanks for any help

didn't try this myself, but use open-uri?

      attachment :content_type => "image/jpeg",         :body => open("http://site.com/an-image.jpg"\).read