Created
September 18, 2008 03:39
-
-
Save zh/11365 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- maildaemon.php 2008-09-18 12:11:19.000000000 +0900 | |
+++ maildaemon.php.new 2008-09-18 12:36:11.000000000 +0900 | |
@@ -29,6 +29,7 @@ | |
require_once(INSTALLDIR . '/lib/common.php'); | |
require_once(INSTALLDIR . '/lib/mail.php'); | |
+require_once('Mail/RFC822.php'); | |
require_once('Mail/mimeDecode.php'); | |
# FIXME: we use both Mail_mimeDecode and mailparse | |
@@ -73,12 +74,12 @@ | |
} | |
function user_from($from_hdr) { | |
- $froms = mailparse_rfc822_parse_addresses($from_hdr); | |
- if (!$froms) { | |
+ $froms = Mail_RFC822::parseAddressList($from_hdr); | |
+ if (PEAR::isError($froms)) { | |
return NULL; | |
} | |
$from = $froms[0]; | |
- $addr = common_canonical_email($from['address']); | |
+ $addr = common_canonical_email($from->mailbox . '@' . $from->host); | |
$user = User::staticGet('email', $addr); | |
if (!$user) { | |
$user = User::staticGet('smsemail', $addr); | |
@@ -88,9 +89,9 @@ | |
function user_match_to($user, $to_hdr) { | |
$incoming = $user->incomingemail; | |
- $tos = mailparse_rfc822_parse_addresses($to_hdr); | |
+ $tos = Mail_RFC822::parseAddressList($to_hdr); | |
foreach ($tos as $to) { | |
- if (strcasecmp($incoming, $to['address']) == 0) { | |
+ if (strcasecmp($incoming, $to->mailbox . '@' . $to->host) == 0) { | |
return true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment