osx - Extract Email Address from eml files -
hi have folder on macbookpro bunch of eml files outlook 2011. i'm trying email addresses out of them, links i've found require buy software or code in c#.
is difficult? i'm trying email list here bunch of old emails.
i know python, r, , sql. if can give me tips on easy way pull email addresses in text file or convert eml files in csv, without buying software or coding in c#, i'd appreciate it.
with php can like:
extract.php
<?php $emails = array(); foreach(rglob("*.eml") $eml){ $emlcontent = file_get_contents($eml); preg_match_all('/([a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,6})/i', $emlcontent, $matches, preg_pattern_order); ($i = 0; $i < count($matches[1]); $i++) { $emails[] .= $matches[1][$i]; } } $emails = array_unique($emails); print_r($emails); function rglob($pattern='*', $flags = 0, $path='') { $paths=glob($path.'*', glob_mark|glob_onlydir|glob_nosort); $files=glob($path.$pattern, $flags); foreach ($paths $path) { $files=array_merge($files,rglob($pattern, $flags, $path)); } return $files; }
usage:
place extract.php
on folder eml files , run terminal php extract.php
Comments
Post a Comment