View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0017652 | phpList 3 application | Bounce Management | public | 23-04-15 13:40 | 21-05-15 12:46 |
Reporter | bst2002 | ||||
Priority | normal | Severity | minor | Reproducibility | always |
Status | new | Resolution | open | ||
Product Version | 3.0.10 | ||||
Target Version | Future developments | Fixed in Version | |||
Summary | 0017652: Email Mime Decode | ||||
Description | Refers to file bounce.php. Email-Data from Table phplist_bounce: Header: Message-ID: <0MeAlq-1Yxj7F1xEM-00Psqe@gmx.net> MIME-Version: 1.0 Auto-Submitted: auto-replied (vacation) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 X-Provags-ID: V03:K0:iFM8T1GM9b3Jr6g2SkCInYCJUere4aE78ALbwhfqzjAMgeMqe0dDG+S Sij0dmHDvwM5pPZnNCuIj7kMopIVNhU7bMR5aOF52BSWl8xwrqeMbRP2pfZId4EBiN0WRjINd wbrNCKYhCozJPLgv4YQMUcE46GbXSXSUW44uDzfp9zh6kkUCZS3lrXWaHiQ5diQbjA/ZLqr6D 0GnkvWRPD0x2Q== X-UI-Out-Filterresults: unknown:0; Data: meine e-mail Adresse hat sich geändert: bitte verwenden Sie ab sofort In file bounce.php starting at Line 180 there is an logic to decode the Email ---SNIP--- $transfer_encoding = ''; if (preg_match('/Content-Transfer-Encoding: ([\w-]+)/i',$bounce["header"],$regs)) { $transfer_encoding = strtolower($regs[1]); } elseif (0 && preg_match('/Content-Type: multipart\/mixed;\s+boundary="([^"]+)"/im',$bounce['header'],$regs)) { ## @TODO, this needs more work, but probably easier to find a class that can ## split is all into it? parts # print "BOUNDARY: ". $regs[1]; $multi_part_boundary = $regs[1]; $parts = explode($multi_part_boundary,$bounce["data"]); var_dump($parts); if (preg_match('/Content-Transfer-Encoding: ([\w-]+)/i',$bounce["data"],$regs)) { # var_dump($regs); # $transfer_encoding = strtolower($regs[1]); } } switch ($transfer_encoding) { case 'quoted-printable': $bounceBody = imap_qprint($bounce["data"]);break; case 'base64': $bounceBody = imap_base64($bounce['data']);break; case '7bit': case '8bit': default: $bounceBody = $bounce['data']; } ---END-SNIP--- so in the example above you get $transfer_encoding = base64; the next step would decode the data-field using imap_base64 and this is wrong. I suggest to use (if installed, otherwise fallback: the logic above or not) http://pear.php.net/package/Mail_mimeDecode/ simple ex.: function mimedecode($text) { require_once('Mail/mimeDecode.php'); $params['include_bodies'] = true; $params['decode_bodies'] = false; $params['decode_headers'] = true; $decoder = new Mail_mimeDecode($text); $structure=$decoder->decode($params); } $decoded_email=mimedecode($bounce['header'].$bounce['data']); ex. outout of $decoded_email obj.: stdClass Object ( [headers] => Array ( [return-path] => <MAILER-DAEMON@mercur.idec.at> [received] => Array ( [0] => from mout-bounce.gmx.net (mout-bounce.gmx.net [212.227.15.46]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mars.idec.at (Postfix) with ESMTPS id 5BB2913C42 for <newsbounces@fangocur.at>; Thu, 23 Apr 2015 05:19:31 +0200 (CEST) ) [x-sieve] => CMU Sieve 2.3 [x-original-to] => test@test.com [delivered-to] => test@test.com [x-amavis-checks] => Mail-ID: kfIVt5IxJb47; processed; [x-spam-checker-version] => SX 3.4.0 (2014-02-07) [x-amavis-rcpt-to] => test@test.com [x-amavis-mail-from] => <> [x-amavis-policy] => none (User-ID: 0); Tags: -999, 999, 999, 999; [from] => user@host.com [to] => test@test.com [subject] => Abwesenheitsnotiz [date] => Thu, 23 Apr 2015 05:19:31 +0200 [message-id] => <0MeAlq-1Yxj7F1xEM-00Psqe@gmx.net> [mime-version] => 1.0 [auto-submitted] => auto-replied (vacation) [content-type] => text/plain; charset="utf-8" [content-transfer-encoding] => base64 [x-provags-id] => V03:K0:iFM8T1GM9b3Jr6g2SkCInYCJUere4aE78ALbwhfqzjAMgeMqe0dDG+S Sij0dmHDvwM5pPZnNCuIj7kMopIVNhU7bMR5aOF52BSWl8xwrqeMbRP2pfZId4EBiN0WRjINd wbrNCKYhCozJPLgv4YQMUcE46GbXSXSUW44uDzfp9zh6kkUCZS3lrXWaHiQ5diQbjA/ZLqr6D 0GnkvWRPD0x2Q== [x-ui-out-filterresults] => unknown:0; ) [ctype_primary] => text [ctype_secondary] => plain [ctype_parameters] => Array ( [charset] => utf-8 ) [body] => meine e-mail Adresse hat sich geändert: bitte verwenden Sie ab sofort ) | ||||
Tags | No tags attached. | ||||
related to | 0017634 | new | decode base64 bounces and present them to administrator for review |
|
If you are suggesting a code change, then this is not the way to do it. It is impossible to work this out. Instead, Fork the repository and send a Pull Request. https://resources.phplist.com/develop/infrastructure |
|
https://github.com/phpList/phplist3/blob/master/CONTRIBUTING.md |