diff options
author | Chuck Hagenbuch <chagenbu@php.net> | 2001-01-03 18:24:20 +0000 |
---|---|---|
committer | Chuck Hagenbuch <chagenbu@php.net> | 2001-01-03 18:24:20 +0000 |
commit | b83ee202c4bb3aa89ed54b4195daa02dd9d435b1 (patch) | |
tree | 9a973551ace15e7be610861a21c88fc740da7920 | |
parent | cc51599f4ac26562639a6f588a5ecd1f4718c2cc (diff) | |
download | php-git-b83ee202c4bb3aa89ed54b4195daa02dd9d435b1.tar.gz |
Mail.php: use the Mail_rfc822:: class to parse addresses. There is a small
performance penalty, but it handles rfc822 groups, which
imap_rfc822_parse_adrlist doesn't.
rfc822.php: Style fixes, some small tweaks/optimizations, and work around a
bit of object weirdness that caused the test for $this (to see if we were
being called statically) to not be sufficient.
-rw-r--r-- | pear/Mail.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/pear/Mail.php b/pear/Mail.php index 191ff7787f..e955510d76 100644 --- a/pear/Mail.php +++ b/pear/Mail.php @@ -116,7 +116,9 @@ class Mail extends PEAR { foreach ($headers as $key => $val) { if ($key == 'From') { - $from_arr = imap_rfc822_parse_adrlist($val, 'localhost'); + include_once 'Mail/rfc822.php'; + + $from_arr = Mail_rfc822::parseAddressList($val, 'localhost'); $from = $from_arr[0]->mailbox . '@' . $from_arr[0]->host; if (strstr($from, ' ')) { // Reject outright envelope From addresses with spaces. @@ -150,6 +152,8 @@ class Mail extends PEAR { */ function parseRecipients($recipients) { + include_once 'Mail/rfc822.php'; + // if we're passed an array, assume addresses are valid and // implode them before parsing. if (is_array($recipients)) { @@ -159,11 +163,11 @@ class Mail extends PEAR { // Parse recipients, leaving out all personal info. This is // for smtp recipients, etc. All relevant personal information // should already be in the headers. - $addresses = imap_rfc822_parse_adrlist($recipients, 'localhost'); + $addresses = Mail_rfc822::parseAddressList($recipients, 'localhost', false); $recipients = array(); if (is_array($addresses)) { foreach ($addresses as $ob) { - $recipients[] = $ob->mailbox . '@' . $ob->host . ' '; + $recipients[] = $ob->mailbox . '@' . $ob->host; } } |