Where the body is depends on how the message is composed. Can you post a small but complete example of a message you are having trouble parsing?

For example, here are relevant bits of a message generated by Outlook, with an attachment:

From - Thu Feb 28 17:29:24 2013
From: xxx@yyy.com
To: aaa@bbb.com
Subject: test
Date: Thu, 28 Feb 2013 04:28:38 +0000
Message-ID: <E24D1C1D2311AC43AA14ACFD05622B7694917B@CHEXCHMBX01.x.com>
Accept-Language: en-NZ, en-US
Content-Language: en-US
X-MS-Has-Attach: yes
X-MS-TNEF-Correlator:
Content-Type: multipart/mixed;
	boundary="_004_E24D1C1D2311AC43AA14ACFD05622B7694917BCHEXCHMBX01cloudh_"
MIME-Version: 1.0

--_004_E24D1C1D2311AC43AA14ACFD05622B7694917BCHEXCHMBX01cloudh_
Content-Type: multipart/alternative;
	boundary="_000_E24D1C1D2311AC43AA14ACFD05622B7694917BCHEXCHMBX01cloudh_"

--_000_E24D1C1D2311AC43AA14ACFD05622B7694917BCHEXCHMBX01cloudh_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

This is the body of the message.

--_000_E24D1C1D2311AC43AA14ACFD05622B7694917BCHEXCHMBX01cloudh_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3D"Generator" content=3D"Microsoft Word 14 (filtered medium)">
<style></style>
</head>
<body lang=3D"EN-NZ" link=3D"blue" vlink=3D"purple">

This is the body of the message.<o:p></o:p>

</body> </html> --_000_E24D1C1D2311AC43AA14ACFD05622B7694917BCHEXCHMBX01cloudh_-- --_004_E24D1C1D2311AC43AA14ACFD05622B7694917BCHEXCHMBX01cloudh_ Content-Type: text/plain; name="test.txt" Content-Description: test.txt Content-Disposition: attachment; filename="test.txt"; size=40; creation-date="Thu, 28 Feb 2013 04:28:39 GMT"; modification-date="Thu, 28 Feb 2013 04:28:52 GMT" Content-Transfer-Encoding: base64 VGhpcyBpcyBhIHRleHQgZmlsZSwgYXMgYW4gYXR0YWNobWVudC4NCg== --_004_E24D1C1D2311AC43AA14ACFD05622B7694917BCHEXCHMBX01cloudh_--

In this case, the first part of the multipart message has the body of the message twice: first as plain text and then as an HTML formatted message.

But your messages may be quite different from this.


In reply to Re^3: receiving email message with an attachment. by ig
in thread receiving email message with an attachment. by tenny1204

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.