note 110939 added to function.imap-rfc822-parse-adrlist
| From: | Anonymous | Date: | Thu, 27 Dec 2012 00:24:31 +0000 |
| Subject: | note 110939 added to function.imap-rfc822-parse-adrlist | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-192684@lists.php.net to get a copy of this message | ||
Before learning about the function I wrote a small piece of code to parse the addresses manually. It
may be of use to someone else.
<?php
function StringToEmailAddresses($value) {
if (preg_match_all("/\s*\"?([^\"\<\>]*?)\"? ?\<?([^@ \>]+)@([^@
\>]+)\>?\s*,?/mi", $value, $matches, PREG_SET_ORDER) !== false) {
$addresses = array();
foreach ($matches as $item) {
$address = new EmailAddress(trim($item[1]), trim($item[2]), trim($item[3]));
$addresses[] = $address;
}
return $addresses;
}
}
?>
----
Server IP: 91.199.167.223
Probable Submitter: 83.82.251.26
----
Manual Page -- http://php.net/manual/en/function.imap-rfc822-parse-adrlist.php
Edit -- https://master.php.net/note/edit/110939
Del: integrated -- https://master.php.net/note/delete/110939/integrated
Del: useless -- https://master.php.net/note/delete/110939/useless
Del: bad code -- https://master.php.net/note/delete/110939/bad+code
Del: spam -- https://master.php.net/note/delete/110939/spam
Del: non-english -- https://master.php.net/note/delete/110939/non-english
Del: in docs -- https://master.php.net/note/delete/110939/in+docs
Del: other reasons-- https://master.php.net/note/delete/110939
Reject -- https://master.php.net/note/reject/110939
Search -- https://master.php.net/manage/user-notes.php