Posted by simon at November 8th, 2007

Here is the PHP function I used to collect email addresses from my Outlook express sent items data file. You pass it text and it will return an array of all email addresses that are in the text. Enjoy!

function extract_emails_from($string){
preg_match_all("/[._a-zA-Z0-9-]+@[._a-zA-Z0-9-]+/i", $string, $matches);
return $matches[0];
}