- New Addition to adButterfly Network FeaturedJuly 9, 2010
- Fresh Wallpapers Featured, GraphicsSeptember 4, 2009
- Whiskey Air Theme Featured, Themes, WordPressSeptember 2, 2009
Harvest Emails From Text File
You might have a text file with a lot of emails, extracted from a mail client or a CSV file created with some script.
Nonetheless, you want to extract all the valid email addresses (user@domain.ext) from the file. Pass this function a file
(you can rename it to .php, or .txt, or .csv) and it will extract all addresses.
function extract_emails_from($string) {
preg_match_all("/[._a-zA-Z0-9-]+@[._a-zA-Z0-9-]+/i", $string, $matches);
return $matches[0];
}
Usage:
<?php
extract_emails_from('myfile.txt');
?>
Tweet This
Digg This
Save to delicious
Stumble it
RSS Feed
1 Comments
This is an interesting post, I have been searching for a emails from texs file I will give this a try out over the next few week, thanks for sharing
[...] Harvest Emails From Text File [...]