Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: receiving email message with an attachment.

by ig (Vicar)
on Feb 28, 2013 at 04:39 UTC ( #1020987=note: print w/ replies, xml ) Need Help??


in reply to Re^2: receiving email message with an attachment.
in thread receiving email message with an attachment.

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.


Comment on Re^3: receiving email message with an attachment.
Re^4: receiving email message with an attachment.
by tenny1204 (Novice) on Feb 28, 2013 at 06:50 UTC

    I red somewhere that all mime entities consisted of a (mime::)head and a (mime::)body, but apparently its not(entirely) true. I'll try some more on my own. Thank you.

      You can read all about it in RFC2045 and related RFCs. Each part of a multipart message has both headers and body.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1020987]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2014-10-01 11:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (9 votes), past polls