I'm trying to connect to an Imap email server and extract the body from email messages.
I've been trying to get the following to work: (Example is supposed to connect to the imap mail server and echo the folders back.)
Problem is it doesnt work! it either doesn't recognise the imap_open command or even worse just leaves me looking at the white finger screen! Please help someone who realllyyyy needs to go back to his nice safe c++ ...
Life jim but not as we know it.
<?php
include 'secretstuff.private';
$mbox = imap_open("$host:993/imap/sslINBOX", "$user", "$password");
echo "<p><h1>Mailboxes</h1>\n";
$folders = imap_listmailbox($mbox, "your.imap.host:993/imap/ssl", "*");
if ($folders == false) {
echo "Call failed<br />\n";
} else {
while (list ($key, $val) = each($folders)) {
echo $val . "<br />\n";
}
}
echo "<p><h1>Headers in INBOX</h1>\n";
$headers = imap_headers($mbox);
if ($headers == false) {
echo "Call failed<br />\n";
} else {
while (list ($key, $val) = each ($headers)) {
echo $val . "<br />\n";
}
}
imap_close($mbox);
?>