[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Read Mail Error using imap_open

Posted on 2005-04-29
Medium Priority
Last Modified: 2012-06-27
hi all,

i have written code for access my inbox thourgh PHP, imap function available in PHP

the code as follows

$inbox = imap_open ("{". $MAIL_HOST . ":143}INBOX", $MAIL_USER, $MAIL_PASS) or die("Error: unable to open mailbox");

$total = imap_num_msg($inbox);

for($x=$total; $x>0; $x--) {
      // get header and structure
      $headers = imap_header($inbox, $x);
      $structure = imap_fetchstructure($inbox, $x);
      htmlspecialchars($headers->fromaddress); // This is the FROM address
      foreach ($headers as $key => $value) {
            if (is_array($value)) $value = implode("\",\"", $value);
            echo $key . " = " . htmlspecialchars($value);
// clean up

When I execute above code, I get the below errors:

Warning: Couldn't open stream {localhost:143}INBOX in

/var/www/html/readinbox1.php on line 16 Error: unable to open mailbox

Warning: Certificate failure for localhost: self signed certificate:
Unit/CN=localhost.localdomain/Email=root@localhost.localdomain (errflg=2) in
Unknown on line 0

How to solve this...Please help me....

Question by:Loganathan Natarajan
1 Comment

Accepted Solution

MBaas earned 100 total points
ID: 14005731
Have you tried using the /notls-flag?  Also I think the curly brackets should better be enclosed in single quotes '{'  etc.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month19 days, 10 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question