note 110939 deleted from function.imap-rfc822-parse-adrlist by aharvey

From: Date: Tue, 08 Jan 2013 02:34:57 +0000
Subject: note 110939 deleted from function.imap-rfc822-parse-adrlist by aharvey
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-192791@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- 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; } } ?>

« previous php.notes (#192791) next »