$con = imap_open("{sitename
ort/(pop3 | smtp)/novalidate-cert}folder", "username", "password");
for Example,
$con = imap_open("{example.com
ort/pop3/novalidate-cert}INBOX", "example@example.com", "password");
$MC = imap_check($con);
$range = "1:".$MC->Nmsgs;
$response = imap_fetch_overview($con,$range);
foreach ($response as $msg) {
$msgno = $msg->msgno;
$message = imap_fetchbody($con,$msgno,1);
$headerinfo=imap_headerinfo($con, $msgno);
$h = get_object_vars($headerinfo);
$maildate = $h['date'];
$from_mail = $h['from'][0]->mailbox."@".$h['from'][0]->host;
$subject = $h['subject'];
$message_id = $h['message_id'];
}
imap_close($con);
variable for all header information of particular mail.