I'm trying to fetch the email address from email account. Following script is working fine for me.
$mbox = imap_open("{mail.b******n.com:143/novalidate-cert}", "myEmail@b******n.com", "myPassWord");
$headers = imap_headers($mbox);
print_r($headers);
if ($headers == false) {
echo "Call failed<br />
";
} else {
foreach ($headers as $val) {
echo $val . "<br />
";
}
}
imap_close($mbox);
Above code is returning date, email address (if no name
) and subject.
Example :
[1118] => 1119)13-May-2016 Facebook You have more friends on (16765 chars)
[1192] => 1193)25-May-2016 John Re: B****c Website Feedba (27152 chars)
[1224] => 1225)30-May-2016 k****n@b***n.c DSR is not submitted prop (83005 chars)
Means above code returning the email if email has no From: Name
. So is there any way to fetch the email addresses only? I would like to appreciate if someone guide me regarding this. Thank You