PHP script to test IMAP
Here is a PHP Script to login to IMAP server.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
<?php $mbox = imap_open("{imap.example.org:143/novalidate-cert}", "username", "password"); echo "<h1>Mailboxes</h1>\n"; $folders = imap_listmailbox($mbox, "{imap.example.org:143}", "*"); 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"; } } imap_close($mbox); |
See PHP