[SOLVED] imap

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phpCCore Brad
Forum Commoner
Posts: 47
Joined: Sun Dec 04, 2005 5:46 pm
Location: Michigan, USA
Contact:

[SOLVED] imap

Post by phpCCore Brad »

Hi, I am trying to make a php script that opens an imap account and takes the e-mails and sends them to a database based on subject. Fort a support system none the less.


My Code So Far

Code: Select all

$mbox = imap_open("{mail.phpccore.com}INBOX", "support@phpccore.com", "****", OP_HALFOPEN)
     or die("can't connect: " . imap_last_error());


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";
   }
}

$folders = imap_listmailbox($mbox, "{mail.phpccore.com}", "*");

if ($folders == false) {
   echo "Call failed<br />\n";
} else {
   foreach ($folders as $val) {
       echo $val . "<br />\n";
   }
}


imap_close($mbox);
The problem I am having is that the headers returns false. So I tried using imap_check. Which for some reason comes back with 0 messages and not in the folder INBOX like I selected. I know their are e-mails in the account I can check it on a client no problem. Any ideas would be great thanks!
phpCCore Brad
Forum Commoner
Posts: 47
Joined: Sun Dec 04, 2005 5:46 pm
Location: Michigan, USA
Contact:

Solved

Post by phpCCore Brad »

I figured it out... I just needed to remove the parameter OP_HALFOPEN since that will only work with viewing the folders on the remote server.
Post Reply