Help on how to access a users mail box from PHP [Solved]
Posted: Tue Sep 19, 2006 6:13 am
Hi all
As part of the app I'm working on I need to be able to access a mail box and parse the contents then return info to the user.
The mail side of things is set up now, and I can send and recieve just fine, however when attempting to use the imap_ commands in PHP I seem to be getting no-where.
The actual code I'm attempting to use is
however nothing seems to happen. No error and no return on the process happen. Just a blank page.
The server info is
OS = Fedora Core 4
PHP = 5.0.4
I installed the RPM for c-client (which I think is right) using webmin to get the Imap dev tools onto the server...
Please note that I'm a complete Linux noob/novice so please make any answers that pertain to the OS as thorough as poss
Cheers
Thanks All
D
As part of the app I'm working on I need to be able to access a mail box and parse the contents then return info to the user.
The mail side of things is set up now, and I can send and recieve just fine, however when attempting to use the imap_ commands in PHP I seem to be getting no-where.
The actual code I'm attempting to use is
Code: Select all
$user = "post";
$password = "posting";
$mbox = imap_open({localhost/pop3:110}INBOX", $user, $password) or die (imap_last_error());
echo "<h1>Mailboxes</h1>\n";
$folders = imap_listmailbox($mbox, "{localhost/pop3:110}INBOX", "*");
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);The server info is
OS = Fedora Core 4
PHP = 5.0.4
I installed the RPM for c-client (which I think is right) using webmin to get the Imap dev tools onto the server...
Please note that I'm a complete Linux noob/novice so please make any answers that pertain to the OS as thorough as poss
Thanks All
D