exportMailAddress.php 753 Bytes
<?php
require_once("../include.php");

$content =  mcFile::getFileContent('Adressbuch_geli-hh_namen.ldif');

//print_r($content);
$array_mail = array();
$string_mail = '';
foreach($content as $lnr =>  $line) {
//	preg_match_all('/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,4})$/', $line, $treffer, PREG_SET_ORDER);

	$pattern="/([\s]*)([_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*([ ]+|)@([ ]+|)([a-zA-Z0-9-]+\.)+([a-zA-Z]{2,}))([\s]*)/i"; 
	preg_match_all($pattern, $line, $treffer);

	if(array_key_exists(0, $treffer) && array_key_exists(0, $treffer[0])) {
		$array_mail[] = $treffer[0][0];
		$string_mail .= $treffer[0][0];
	} else {
		echo($lnr.': '.$line."\n");

	}

}
print_r($array_mail);

mcFile::write('mail.txt', $string_mail);

?>