Attaching, literally, a link

Hi,

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

URL=“http://www.biltd.com

Content-type: text/html
Content-Transfer-Encoding: Binary

THIS IS NOT THE BODY!

–mimepart_4b955ae181878_1b83faad4933fb41189–

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!

Suggestions appreciated.

Thank you.

Regards,
Rich

On Mon, Mar 8, 2010 at 3:40 PM, theduz [email protected] wrote:

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

Content-Transfer-Encoding: binary

THIS IS NOT REALLY THE BODY!

Not tested:

attachment :content_type => “message/external-body; access-
type=URL; URL=URL=“http://www.biltd.com”” do |a|
a.transfer_encoding = “binary”
a.body = “THIS IS NOT THE REAL BODY!\n”
end


Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs