Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP email

Status
Not open for further replies.

mufka

ISP
Dec 18, 2000
587
US
Is there a way, with PHP, to fetch email from a POP or IMAP server? I know how to send, just want to see if I can receive.
 
I tried to use one of the examples in the above mentioned link, but I'm not getting anything. The code is:

Code:
<?php
$mbox = imap_open("{imap.example.org:143}", "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);
?>
I changed the hostname, username and password, but I just get "Call failed". I can access the mailbox using SquirrelMail so I know IMAP works on the server.
 
Solved my own problem. Needed to use /notls.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top