|
|
|
|
||||||
| comp.mail.imap Discussion of IMAP-based mail systems. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 (permalink) |
|
Messages: n/a
Hébergeur: |
Was forced to convert application from POP3 to IMAP.
Seems the only thing I can't figure out is how to fetch the body of the multiparts "text/plain" and "text/html". I've searched the internet and found many examples, but no actual syntax for the fetch on getting [2.mime] parts. If anyone could point me to a site or give me the syntax I'd really appreciate it. Here's what I'm looking at: ======================================== ================================================== ====================================== Given the following message that was created by an Outlook form: qq fetch 1 RFC822 * 1 FETCH (RFC822 {1256} Received: from ms012.parknicollet.com ([192.168.36.112]) by ms016.parknicollet. com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 25 Apr 2006 14:07:20 -0500 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C6689B.79D72400" Content-class: urn:content-classes:message Return-Path: <John.Nygaard@ParkNicollet.com> X-OriginalArrivalTime: 25 Apr 2006 19:07:20.0078 (UTC) FILETIME=[79E30AE0:01C668 9B] X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Message From DT5XMD981 nygaaj Date: Tue, 25 Apr 2006 14:07:18 -0500 Message-ID: <B6E50D3B491D3C408E3D7507475C797E15D4F545@ms012.pa rknicollet.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Message From DT5XMD981 nygaaj Thread-Index: AcZom3j5eKirv3sIQa2TC8XaIXmxnQ== From: "Nygaard, John K." <John.Nygaard@ParkNicollet.com> To: "pnmbrd" <pnmbrd@ParkNicollet.com> This is a multi-part message in MIME format. ------_=_NextPart_001_01C6689B.79D72400 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable ------_=_NextPart_001_01C6689B.79D72400 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable ------_=_NextPart_001_01C6689B.79D72400-- ) qq OK FETCH completed. I would like to fetch the text/html. What is the exact syntax in IMAP to retrieve it from an exchange server. (i.e a006 fetch 1 body[…….]) ================================================== ============================= TIA~! |
|
|
|
#2 (permalink) |
|
Messages: n/a
Hébergeur: |
On Thu, 27 Apr 2006, John K. Nygaard wrote:
> Seems the only thing I can't figure out is how to fetch the body of > the multiparts "text/plain" and "text/html". I've searched the > internet and found many examples, but no actual syntax for the fetch > on getting [2.mime] parts. If anyone could point me to a site or give > me the syntax I'd really appreciate it. Please read RFC 3501. All is revealed there. It is impossible to implement a working IMAP client without reading RFC 3501. -- Mark -- http://panda.com/mrc Democracy is two wolves and a sheep deciding what to eat for lunch. Liberty is a well-armed sheep contesting the vote. |
|
|
|
#3 (permalink) |
|
Messages: n/a
Hébergeur: |
I've have read RFC3501. Throw me a bone here. I've not found one
example of anything anywhere on the NET that shows the server client/response of retrieving even a text/plain portion of a message. I've seen numerous accounts of: ============================================= The TEXT part specifier refers to the text body of the message, omitting the [RFC-2822] header. Here is an example of a complex message with some of its part specifiers: HEADER ([RFC-2822] header of the message) TEXT ([RFC-2822] text body of the message) MULTIPART/MIXED 1 TEXT/PLAIN 2 APPLICATION/OCTET-STREAM 3 MESSAGE/RFC822 3.HEADER ([RFC-2822] header of the message) 3.TEXT ([RFC-2822] text body of the message) MULTIPART/MIXED 3.1 TEXT/PLAIN 3.2 APPLICATION/OCTET-STREAM 4 MULTIPART/MIXED 4.1 IMAGE/GIF 4.1.MIME ([MIME-IMB] header for the IMAGE/GIF) 4.2 MESSAGE/RFC822 4.2.HEADER ([RFC-2822] header of the message) 4.2.TEXT ([RFC-2822] text body of the message) MULTIPART/MIXED 4.2.1 TEXT/PLAIN 4.2.2 MULTIPART/ALTERNATIVE 4.2.2.1 TEXT/PLAIN 4.2.2.2 TEXT/RICHTEXT ========================================= but never how to actually figure it out. How would one code a statememt to have the server display the above info?????? On Thu, 27 Apr 2006 08:08:36 -0700, Mark Crispin <mrc@CAC.Washington.EDU> wrote: >On Thu, 27 Apr 2006, John K. Nygaard wrote: >> Seems the only thing I can't figure out is how to fetch the body of >> the multiparts "text/plain" and "text/html". I've searched the >> internet and found many examples, but no actual syntax for the fetch >> on getting [2.mime] parts. If anyone could point me to a site or give >> me the syntax I'd really appreciate it. > >Please read RFC 3501. All is revealed there. > >It is impossible to implement a working IMAP client without reading RFC >3501. > >-- Mark -- > >http://panda.com/mrc >Democracy is two wolves and a sheep deciding what to eat for lunch. >Liberty is a well-armed sheep contesting the vote. |
|
|
|
#4 (permalink) |
|
Messages: n/a
Hébergeur: |
On Mon, 1 May 2006, John K. Nygaard wrote:
> I've have read RFC3501. Throw me a bone here. I've not found one > example of anything anywhere on the NET that shows the server > client/response of retrieving even a text/plain portion of a message. You must first fetch the BODYSTRUCTURE. This will return a tree structure of the message using LISP-style S-expression syntax. Your program needs to analyze that structure before doing anything else. The key paragraphs of RFC 3501 are here: Every message has at least one part number. Non-[MIME-IMB] messages, and non-multipart [MIME-IMB] messages with no encapsulated message, only have a part 1. Multipart messages are assigned consecutive part numbers, as they occur in the message. If a particular part is of type message or multipart, its parts MUST be indicated by a period followed by the part number within that nested multipart part. Let's now consider the simple case of a non-MIME message. This message has just one part, and thus one part number which is 1. Thus, a FETCH command which would fetch the message body of such a message would be: tag FETCH messagenumber BODY[1] Now, let's consider the case of a single-part MIME message. Once again, this message has just one part, and once again: tag FETCH messagenumber BODY[1] The BODYSTRUCTURE from IMAP of the above two cases will be identical! It will contain a list, with a single part list inside. Now, let's consider a single-level multi-part MIME message (the most common case) e.g., a simple message with attachments. Since the part numbers are consecutive, you would do: tag FETCH messagenumber BODY[1] for the first part tag FETCH messagenumber BODY[2] for the second part, and so on. Now, let's consider a multi-level multi-part MIME message; this happens most commonly when forwarding a message. Suppose it's a forwarded message expressed as an attachment to the comments that the forwarding user has made. You would then have: tag FETCH messagenumber BODY[1] for the forwarding user's comments, and tag FETCH messagenumber BODY[2.1] for the first part of the forwarded message. Note that you can't wire in any of this behavior. You MUST, repeat MUST!!! get the BODYSTRUCTURE tree and follow the tree. If you have a copy of the UW IMAP toolkit, the mtest demonstration program has a little recursive routine that walks down the tree and builds part identifiers. It will also show what the BODYSTRUCTURE tree looks like along with those part identifiers. Try it on various messages. When you think that you understand it, get a copy of the infamous "MIME torture test" on ftp://ftp.cac.washington.edu/mail/mi...ture-test.mbox and see what the tree for that message looks like. It is also possible to fetch header data. That is what HEADER (for message-level parts) and MIME (for other parts) do. But that's an advanced topic. Walk before you try to run; right now you're crawling so you should disregard all that for all now. -- Mark -- http://panda.com/mrc Democracy is two wolves and a sheep deciding what to eat for lunch. Liberty is a well-armed sheep contesting the vote. |
|
![]() |
| Outils de la discussion | |
|
|