note 74970 added to function.mailparse-rfc822-parse-addresses

From: Date: Mon, 07 May 2007 06:05:58 +0000
Subject: note 74970 added to function.mailparse-rfc822-parse-addresses
Groups: php.notes 
Request: Send a blank email to php-notes+get-126270@lists.php.net to get a copy of this message
To just extract the email address out of an RFC822 line, it's faster and more reliable to just use a simple regex such as: <?php $rfc = '"Bob Smith" <bob@smith.com>'; preg_match('/[\\w\\.\\-+=*_]*@[\\w\\.\\-+=*_]*/', $rfc , $regs); $parsed = $regs[0]; ?> The above code will pull out: bob@smith.com No matter the variation of the RFC822 line, as long as there's a valid email address in it somewhere, the above regex will find it. ---- Server IP: 69.147.83.197 Probable Submitter: 76.187.237.57 ---- Manual Page -- http://www.php.net/manual/en/function.mailparse-rfc822-parse-addresses.php Edit -- https://master.php.net/note/edit/74970 Del: integrated -- https://master.php.net/note/delete/74970/integrated Del: useless -- https://master.php.net/note/delete/74970/useless Del: bad code -- https://master.php.net/note/delete/74970/bad+code Del: spam -- https://master.php.net/note/delete/74970/spam Del: non-english -- https://master.php.net/note/delete/74970/non-english Del: in docs -- https://master.php.net/note/delete/74970/in+docs Del: other reasons-- https://master.php.net/note/delete/74970 Reject -- https://master.php.net/note/reject/74970 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#126270) next »