I'm trying to avoid sending large PDF's via email. My current strategy is to put a link to the document or web page into the e-mail, and it works just fine, but I'm getting complaints that "the attachment is missing". Is there a way to have a link show up as an attachment?
I've tried to use the RFC 2017 strategy of using content type message/ external-body, but I don't think rails is formatting the attachment quite right, or maybe outlook (majority of receivers use outlook) doesn't understand it?
part :content_type => "multipart/alternative" do |a| a.part "text/plain" do |p| p.body = render_message 'mailing.text.plain.rhtml', :mailing => mailing end
a.part "text/html" do |p| p.body = render_message 'mailing.text.html.rhtml', :mailing => mailing end end
attachment :content_type => "message/external-body; access- type=URL;" do |a| a.transfer_encoding = "binary" a.body = "URL=\"http://www.biltd.com\"\n\nContent-type: text/html \nContent-Transfer-Encoding: Binary\n\nTHIS IS NOT THE BODY!\n" end
Produces, in part:
--mimepart_4b955ae181878_1b83faad4933fb41189 Content-Type: message/external-body; access-type=URL Content-Transfer-Encoding: Binary Content-Disposition: attachment; access-type=URL
Content-type: text/html Content-Transfer-Encoding: Binary
THIS IS NOT THE BODY!
Which doesn't look quite like RFC2017 shows. There seems to be an extra new line, and a couple extra headers. RFC2017 expects the mime body to look like:
Content-type: message/external-body; access-type=URL; URL="http://www.foo.com/file"
Content-type: text/html Content-Transfer-Encoding: binary
THIS IS NOT REALLY THE BODY!