Jump to content

Recommended Posts

Hello,
Having trouble logging on to hosting company's shared server using IMAP. The webmail program I am using in the root of my site won't log on and I can't log on with a testing script either. They insist the extensions are installed correctly as HORDE and Squirrelmail work OK.

PHP v 5.1.4 IMAP c-client version 2004

I have used the test script below loaded into the root of the domain and get the message:

Warning: imap_open() [function.imap-open]: Couldn't open stream {localhost:143/imap/notls}INBOX in /home/*****/public_html/imap_test2.php on line 10

Warning: imap_check(): supplied argument is not a valid imap resource in /home/*****/public_html/imap_test2.php on line 13
....
....
....

Is there something wrong with the script, am I unable to run it from the root of my domain, or is there something else such as the server not allowing this?

<HTML>
<HEAD>
<TITLE>imap_check</TITLE>
</HEAD>
<BODY>
<?
//check for new messages

$mailbox = imap_open("{localhost/imap:143}INBOX",
"myname@mydomain.com","mypassword");

// Check messages
$check = imap_check($mailbox);
print("<PRE>");
print("Date most recent message : " . $check->Date);
print("<BR>");
print("Connection type : " . $check->Driver);
print("<BR>");
print("Name of the mailbox : " . $check->Mailbox);
print("<BR>");
print("Number of messages : " . $check->Nmsgs);
print("<BR>");
print("Number of recent messages : " . $check->Recent);
print("<BR>");
print("</PRE>");

// show headers for messages

$index=1;

$header = imap_header($mailbox, $index);
print("<PRE>");
print("Header Date : " . $header->Date . "<BR>");
print("Header To : " . $header->to) . "<BR>";
print("Header From : " . $header->From . "<BR>");
print("Header cc : " . $header->cc . "<BR>");
print("Header ReplyTo : " . $header->ReplyTo . "<BR>");
print("Header Subject : " . $header->Subject . "<BR></PRE>");

print("<PRE>");
print(imap_body($mailbox,$index));
print("</PRE><HR>");

imap_close($mailbox);
?>

</BODY></HTML>
Link to comment
https://forums.phpfreaks.com/topic/11644-php-and-imap-extension/
Share on other sites

Any ideas? Please
I have now added:

or die("can't connect: ".imap_last_error());

to the imap_open() part of the script and now get the message:


Warning: imap_open() [function.imap-open]: Couldn't open stream {localhost/imap:143}INBOX in /home/*****/public_html/imap_test2.php on line 9
can't connect: Can not authenticate to IMAP server: AUTHENTICATE LOGIN failed
Link to comment
https://forums.phpfreaks.com/topic/11644-php-and-imap-extension/#findComment-44146
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.