php - How to extract data from POP3 email? -
i receive email pop3 server php. have raw string containing headers , body. how can headers , body parsed in form of class or array?
example of have:
return-path: envelope-to: x@x.de delivery-date: wed, 06 feb 2013 09:35:37 +0100 received: mail service host6.toxpress.com spam-scanned (exim 4.80.1) (envelope-from ) id 1u30tc-0003sh-lq 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: moh3-ve2.go2.pl ([193.17.41.86] helo=moh3-ve1.go2.pl) host6.toxpress.com esmtp (exim 4.80.1) (envelope-from ) id 1u30tc-0003rk-2b x@x.de; wed, 06 feb 2013 09:35:32 +0100 received: moh3-ve1.go2.pl (unknown [10.0.0.157]) moh3-ve1.go2.pl (postfix) esmtp id bc734af611b ; wed, 6 feb 2013 09:34:31 +0100 (cet) received: unknown (unknown [10.0.0.108]) moh3-ve1.go2.pl (postfix) smtp ; wed, 6 feb 2013 09:34:31 +0100 (cet) received: 43.dynamic.chello.pl [89.69.42.127] poczta.o2.pl 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 want able do:
echo $from; echo $replyto; echo $date; echo $body; echo $subject; echo $charset;
have @ mime e-mail message parser class. according author's description:
this class can used parse , decode mime e-mail messages. supports decoding single rfc 2822 mime messages or archives aggregate multiple messages in mbox format. the decoded message info returned array describes 1 or more messages found in message file or info string. bodies of multipart messages can decoded distinct sub-messages. message body info can decoded , saved separate files, class can handle messages larger available memory.
php email pop3
No comments:
Post a Comment