Can't seem to get my code to work. Warning: preg_match_all() expects parameter 2 to be string, array given in /script.php on line 23. I am looking to retrieve a list of emails addresses:
<?php
$mbox = imap_open("{******.com:143/notls}", "******@******.com", "******");
echo "<h1>Email Addresses</h1>
";
$headers = imap_headers($mbox);
if ($headers == false) {
echo "Call failed<br />
";
} else {
foreach ($headers as $val) {
preg_match_all('/([^: ]+): (.+?(?:
\s(?:.+?))*)
/m', $headers, $matches);
echo $maches[2] . "<br />
";
}
}
imap_close($mbox);
?>