We help IT Professionals succeed at work.

imap php

PhillO
PhillO asked
on
Medium Priority
486 Views
Last Modified: 2012-06-21
Am trying to connect to my fedora 14 64bit imap server using php the code is below.

However, I am getting the following error and don't know where to start to solve it
"Can't open mailbox localhost:143INBOX: no such mailbox "
Any Ideas?

<?php
$host = 'localhost:143';
$user = 'user';
$password = 'password';
$mailbox = "{$host}INBOX";

$mbox = imap_open($mailbox , $user , $password);
$str = imap_errors();  echo("imap_errors():\n");  print_r($str);

if (imap_ping($mbox)){ print "success";}
else                 { print "fail"; }

imap_close($mbox);

?>

Open in new window

Comment
Watch Question

Commented:
Try wrapping your host with "{}".

$host = '{localhost:143}';

Author

Commented:
StingRaY

Thanks for responding but if you look on Line 5 it is
Commented:
No. It's different. If you echo line 5, it will be "localhost:143INBOX" not "{localhost:143}INBOX".

Author

Commented:
StingRaY

Your dead right!!! thanks

Explore More ContentExplore courses, solutions, and other research materials related to this topic.