Skip to content

Instantly share code, notes, and snippets.

@andrei-tofan
Created July 17, 2017 08:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrei-tofan/346829f6666fbd376d327053995d6669 to your computer and use it in GitHub Desktop.
Save andrei-tofan/346829f6666fbd376d327053995d6669 to your computer and use it in GitHub Desktop.
Test local IMAP server
<?php
// To connect to an IMAP server running on port 993 on the local machine,
// do the following:
$mbox = imap_open("{mailmoka.com:993/imap/ssl/novalidate-cert}INBOX", "delivery", "Ahgn8WKqyQGqgpeXiInh");
echo "<h1>Mailboxes</h1>\n";
$folders = imap_listmailbox($mbox, "{mailmoka.com:993}", "*");
if ($folders == false) {
echo "Call failed<br />\n";
} else {
foreach ($folders as $val) {
echo $val . "<br />\n";
}
}
echo "<h1>Headers in INBOX</h1>\n";
$headers = imap_headers($mbox);
if ($headers == false) {
echo "Call failed<br />\n";
} else {
foreach ($headers as $val) {
echo $val . "<br />\n";
}
}
// $message = imap_fetchbody($mbox, 10, 1);
// echo $message;
imap_close($mbox);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment