note 57869 added to function.imap-rfc822-parse-adrlist

From: Date: Mon, 17 Oct 2005 13:50:50 +0000
Subject: note 57869 added to function.imap-rfc822-parse-adrlist
Groups: php.notes 
Request: Send a blank email to php-notes+get-97117@lists.php.net to get a copy of this message
This function does NOT test the syntax of either the local part, or the host part, it will permit illegal characters on either side. Note that 'host' refers to the email domain, not actually to any host. The at domain list is an obsolete addressing method which was available for routing email. RFC2822 says that it must be accepted, but should be ignored in routing. Note that if an address doesn't contain a personal part, or an "at domain list", that part of the array will be missing. Although RFC2822 permits consecutive comma separators in a list of email addresses, this function does not. That's probably a bug. In the following list of examples, #4 uses an "at domain list", #5 and after are illegal domains, but only the last actually generates an error. $adds = 'ian eiloart <iane@example.ac.uk>, shuf6@example.ac.uk, blobby, "ian,eiloart"<ian@example.ac.uk>, <@example.com:foo@example.ac.uk>, foo@#, ian@-example.com, ian@one@two'; $add_arr = imap_rfc822_parse_adrlist($adds, 'example.com'); var_export ($add_arr); array ( 0 => class stdClass { var $mailbox = 'iane'; var $host = 'example.ac.uk'; var $personal = 'ian eiloart'; }, 1 => class stdClass { var $mailbox = 'shuf6'; var $host = 'example.ac.uk'; }, 2 => class stdClass { var $mailbox = 'blobby'; var $host = 'example.ac.uk'; }, 3 => class stdClass { var $mailbox = 'ian'; var $host = 'example.ac.uk'; var $personal = 'ian,eiloart'; }, 4 => class stdClass { var $mailbox = 'foo'; var $host = 'example.ac.uk'; var $adl = '@example.com'; }, 5 => class stdClass { var $mailbox = 'foo'; var $host = '#'; }, 6 => class stdClass { var $mailbox = 'ian'; var $host = '-example.com'; }, 7 => class stdClass { var $mailbox = 'ian'; var $host = 'one'; }, 8 => class stdClass { var $mailbox = 'UNEXPECTED_DATA_AFTER_ADDRESS'; var $host = '.SYNTAX-ERROR.'; }, ) ---- Manual Page -- http://www.php.net/manual/en/function.imap-rfc822-parse-adrlist.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+57869 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57869&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57869&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57869&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57869&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57869&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57869&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57869&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+57869&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#97117) next »