I would like to display all the subjects of email received on a website. Is there an open source "pop to php" script? Or a service I can use directly?
Any help is appreciated! thanks!
I would like to display all the subjects of email received on a website. Is there an open source "pop to php" script? Or a service I can use directly?
Any help is appreciated! thanks!
Hi, I would use the built-in PHP IMAP functions. Here's a sample for you:
$mbox = imap_open ("{yourserver.com:110/pop3/novalidate-cert}INBOX", "[email protected]", "myPassword");
if (!$mbox) {
return false;
}
$m_search = imap_search($mbox, 'UNDELETED');
$messages = array();
if($m_search < 1) {
return 'No New Messages';
} else {
foreach ($m_search as $item) {
$headers = imap_headerinfo($mbox, $item);
$struct = imap_fetchstructure($mbox, $item);
$body = imap_body($mbox, $item);
$headers->subtype = $struct->subtype;
$headers->body = $body;
$messages[] = $headers;
}
}
imap_close($mbox);