Is there anything wrong with doing it in two passes? One to determine whether you have inline and/or attached attachments, and the second to produce the headers?
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of [email protected] Sent: Monday, February 09, 2009 11:32 AM To: Development list Subject: Re: [openchange][devel] multipart/related The grouping I presented in the second example is the result that I want to achieve. Libmapi gives me an attachment table and I take the attachements in the order in which they show up in that table. How do I make sure that this order corresponds to the grouping that I need? I'm thinkking about the following algorithm that should be used if content-type = multipart/mixed: print the normal headers (multipart/mixed) print a multipart/related header with a new boundary (eg uuid) print the body for all attachements if content-id is not null print a multipart/related boundary print the header incl content-id print the attachment else if this is the first time in the else branch: print the multipart/related--end boundary print a multipart/mixed boundary print the header print the attachment end if end for if we haven't printed the multipart/related--end boundary yet, do it now print the multipart/mixed--end boundary Now back to the example: If the attachments table gives me the jpg (inline company logo) before the pdf (real attachment), then I will be fine. If the attachments come in the reversed order, this idea won't work. The question is really whether I can rely on some order or whether I have to scan through the body text, search for all cid tags, memorize these somehow, print the body, then run through the attachments twice, first printing the ones with the content-ids that I need, then the rest. > ----- Original Message ----- > From: "Cain Random" <[email protected]> > To: "Development list" <[email protected]> > Subject: Re: [openchange][devel] multipart/related > Date: Mon, 9 Feb 2009 07:37:03 -0800 > > > What order the attachments are listed in the RFC 822 message shouldn't > matter as long as you've grouped them correctly. You've figured out > the right scheme, so you should be alright. > > What's your question? How to determine wheter a given attachment is > inline or not? > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of > [email protected] > Sent: Monday, February 09, 2009 9:19 AM > To: [email protected] > Subject: [openchange][devel] multipart/related > > Hello all, > > Some brainstorming: > > In order for Thunderbird and Evolution to display inline images that > are referred to in a 'cid' URL, I need to bracket the body and the > images with Content-Type: multipart/related, and I need to print a > Content-ID header which is not an issue. If an email contains only a > body and some cid images, Exchange gives me the expected > multipart/related header and everything is fine. > > However, when an email contains an inline image, for example a company > logo in a signature, and a regular attachment, for example a pdf file, > I get the following: > > Content-Type: multipart/mixed; boundary="--part1" > > ----part1 > Content-Type: text/plain > > blah blah > <img src="cid:123@abc"> > > ----part1 > Content-Type: image/jpeg > Content-ID: <1...@abc> > > 7651djfgarty893475789 > > ----part1 > Content-Type: application/pdf > > 846578962ergfjksdghfv346bv > ----part1-- > > > What Thunderbird would need should look like this: > > Content-Type: multipart/mixed; boundary="--part1" > > ----part1 > Content-Type: multipart/related; boundary="--part1A" > > ----part1A > Content-Type: text/plain > > blah blah > <img src="cid:123@abc"> > > ----part1A > Content-Type: image/jpeg > Content-ID: <1...@abc> > > 7651djfgarty893475789 > > ----part1A-- > > ----part1 > Content-Type: application/pdf > > 846578962ergfjksdghfv346bv > ----part1-- > > > Printing those extra headers shouldn't be too diffuclt, but I would > have to make sure that the attachments are in the right order. In > particular, all attachments that have a Content-ID that appears in the > body should come before all the others that don't. Do we know how > Exchange sorts the attachments or is there a way to control it? I > think I've read somewhere on MSDN that attachments should be sorted in > the way they should be rendered. I would assume that this means all > the inline stuff comes before the real attachments, but I am not sure. > > Is anyone familiar with this issue? I'd appreciate it if you could > share some thought and ideas. > > thanks > > dirk > > > > -- > Be Yourself @ mail.com! > Choose From 200+ Email Addresses > Get a Free Account at www.mail.com > > _______________________________________________ > devel mailing list > [email protected] > http://mailman.openchange.org/listinfo/devel > > ---------------------------------- > Barracuda Networks makes the best spam firewalls and web filters. > www.barracudanetworks.com > _______________________________________________ > devel mailing list > [email protected] > http://mailman.openchange.org/listinfo/devel > -- Be Yourself @ mail.com! Choose From 200+ Email Addresses Get a Free Account at www.mail.com _______________________________________________ devel mailing list [email protected] http://mailman.openchange.org/listinfo/devel ---------------------------------- Barracuda Networks makes the best spam firewalls and web filters. www.barracudanetworks.com _______________________________________________ devel mailing list [email protected] http://mailman.openchange.org/listinfo/devel
