Hi,
I''m working on writing an inboound TMail gateway to a web application.
So far I''ve been very pleased with TMail''s capabilities and
ease of
use. Thanks!
One of the challenges I''m looking at is handling messages with
attachments, such as images or documents. For example, the quoted
message below from Apple''s Mail.app has two inline images separating
three parts of text. The overall structure is:
==========Hi I''m having some trouble with this image:
[image]
and I want it look like this:
[image]
--
Signature
==========
It there a good way to pull out the message text (in three parts) from
the included attachments without my having to read all of RFCs
2045,2046.
Other message compositions I''ve seen are: multipart/mixed( multipart/
alternative (text/plain, text/html)), attachment).
And so on.
I guess I could do a join of all the parts that are text/plain (unless
they''re attachments or inline) to make the message body. But I
suspect that someone has done all this before and I''m loathe to
reinvent the wheel (esp. since I doubt mine would roll too well).
So, to recap, does anyone have any code to suggest that would help
pull apart multipart messages into the ''message content'' and
associate
attachments/inline parts?
Thanks,
Peter
> To: Peter Burkholder <burkholp at .gov>
> Content-Type: multipart/mixed; boundary=Apple-Mail-4-3849828
> Mime-Version: 1.0 (Apple Message framework v926)
> Subject: Another test
> Date: Tue, 9 Sep 2008 12:11:41 -0400
> X-Mailer: Apple Mail (2.926)
> Return-Path: burkholp at .gov
>
>
> --Apple-Mail-4-3849828
> Content-Type: text/plain;
> charset=US-ASCII;
> format=flowed
> Content-Transfer-Encoding: 7bit
>
> Hi I''m having some trouble with this image:
>
>
> --Apple-Mail-4-3849828
> Content-Disposition: inline;
> filename=left.GIF
> Content-Type: image/gif;
> x-unix-mode=0644;
> name="left.GIF"
> Content-Transfer-Encoding: base64
>
> R0lGODlhggAtAMT/AP////L1+fH1+OXs8uXr8tni7Nji68zZ5cjW47/
> P37vM3bLF2a3C1qW80qG4
>
0JmzzJGsyI2pxoSjwYCgv3eZu3OWuWmPtGaMs1mDrE15pkBwnzNmmQAAAAAAAAAAAAAAACwAAAAA
> [snip]
> YKHg
> +
> FtXlgkyKCZ3OTepC3ywaRg1lq2WBAPSYAABeSQgYeI01aR6pyNc5lDBpjaA2UyBIiDlZlSn
> DUKMEr8Eg8B1xeBq3rHIJqssaSEAADuz0LoQAgA7VmvtBLW0hAAAOw=>
> --Apple-Mail-4-3849828
> Content-Type: text/plain;
> charset=US-ASCII;
> format=flowed
> Content-Transfer-Encoding: 7bit
>
>
>
>
> and I want it to look like this:
>
> --Apple-Mail-4-3849828
> Content-Disposition: inline;
> filename=left.GIF
> Content-Type: image/gif;
> x-unix-mode=0644;
> name="left.GIF"
> Content-Transfer-Encoding: base64
>
> R0lGODlhggAtAMT/AP////L1+fH1+OXs8uXr8tni7Nji68zZ5cjW47/
> P37vM3bLF2a3C1qW80qG4
>
0JmzzJGsyI2pxoSjwYCgv3eZu3OWuWmPtGaMs1mDrE15pkBwnzNmmQAAAAAAAAAAAAAAACwAAAAA
> [snip]
> YKHg
> +
> FtXlgkyKCZ3OTepC3ywaRg1lq2WBAPSYAABeSQgYeI01aR6pyNc5lDBpjaA2UyBIiDlZlSn
> DUKMEr8Eg8B1xeBq3rHIJqssaSEAADuz0LoQAgA7VmvtBLW0hAAAOw=>
> --Apple-Mail-4-3849828
> Content-Type: text/plain;
> charset=US-ASCII;
> format=flowed;
> delsp=yes
> Content-Transfer-Encoding: 7bit
>
>
>
> --
> Peter Burkholder [Contractor]
> +1-301-402-7499 burkholp at .gov
> Applications Administrator, NCBI/NLM/NIH
>
>
>
>
>
> --Apple-Mail-4-3849828--