like i said, for most of the time, this works great, but there's times during the day that i get the error "Connection Refused" when i call imap_last_error()...i thought the whole server was undergoing maintenance or something, but sending mail to the mailboxes worked fine.
in my call below, $emailUserInfo->imap_host looks like this:
{myserver.com:143}
the mail is kept in the user's ~Mail dir, not by standard...i had to create a .procmailrc file to do that...(didn't want to use it system-wide). before the call, the mailbox name is stored in $mboxName. This code below tries to connect to that mailbox, and if it can't (mailbox might not exist), then it defaults to the inbox, ~Mail/Inbox
thanks in advance!!!
here's the call:
$mbox = imap_open(imap_utf7_encode($emailUserInfo->imap_host . 'Mail/' . $mboxName), $emailUserInfo->imap_alias, $emailUserInfo->imap_password);
if(!$mbox){
default to Inbox on error
$mboxName = 'Inbox';
$mbox = imap_open(imap_utf7_encode($emailUserInfo->imap_host . 'Mail/' . $mboxName), $emailUserInfo->imap_alias, $emailUserInfo->imap_password);
}
if(!$mbox){
TODO: handle this error
print "Unable to open your mailbox right now.<BR>";
print "ERROR: " . imap_last_error() . "<BR>";
exit;
}