I am receiving email from a POP3 server with PHP. I have a source line containing headers and body. How can I handle the headers and body as a class or array?
An example of what I have:
Return-path: Envelope-to: x@x.de Delivery-date: Wed, 06 Feb 2013 09:35:37 +0100 Received: from mail by host6.toxpress.com with spam-scanned (Exim 4.80.1) (envelope-from ) id 1U30Tc-0003sH-LQ for x@x.de ; Wed, 06 Feb 2013 09:35:36 +0100 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on host6.toxpress.com X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,TVD_SPACE_RATIO autolearn=ham version=3.3.2 Received: from moh3-ve2.go2.pl ([193.17.41.86] helo=moh3-ve1.go2.pl) by host6.toxpress.com with esmtp (Exim 4.80.1) (envelope-from ) id 1U30Tc-0003rk-2b for x@x.de ; Wed, 06 Feb 2013 09:35:32 +0100 Received: from moh3-ve1.go2.pl (unknown [10.0.0.157]) by moh3-ve1.go2.pl (Postfix) with ESMTP id BC734AF611B for ; Wed, 6 Feb 2013 09:34:31 +0100 (CET) Received: from unknown (unknown [10.0.0.108]) by moh3-ve1.go2.pl (Postfix) with SMTP for ; Wed, 6 Feb 2013 09:34:31 +0100 (CET) Received: from 43.dynamic.chello.pl [89.69.42.127] by poczta.o2.pl with ESMTP id jtIGfv; Wed, 06 Feb 2013 09:34:31 +0100 Message-ID: < 51121593.3090008@o2.pl > Date: Wed, 06 Feb 2013 09:34:27 +0100 From: Tomasz Reply-To: tomasz_smykrowski@o2.pl Organization: Tomasz User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:20.0) Gecko/20100101 Thunderbird/20.0a2 MIME-Version: 1.0 To: x@x.de Subject: adaads Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-O2-Trust: 2, 64 X-O2-SPF: neutral dsadasdsaas .
And what I want to do:
echo $from; echo $replyTo; echo $date; echo $body; echo $subject; echo $charset;
source share