Loganathan Natarajan
asked on
Read Mail Error using imap_open
hi all,
i have written code for access my inbox thourgh PHP, imap function available in PHP
the code as follows
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- -------
$MAIL_HOST="localhost";
$MAIL_USER="user";
$MAIL_PASS="pwd";
$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- >fromaddre ss); // This is the FROM address
foreach ($headers as $key => $value) {
if (is_array($value)) $value = implode("\",\"", $value);
echo $key . " = " . htmlspecialchars($value);
}
}
// clean up
imap_close($inbox);
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- -------
When I execute above code, I get the below errors:
Warning: Couldn't open stream {localhost:143}INBOX in
/var/www/html/readinbox1.p hp on line 16 Error: unable to open mailbox
Warning: Certificate failure for localhost: self signed certificate:
/C=--/ST=SomeState/L=SomeC ity/O=Some Organizati on/OU=Some Organizati onal
Unit/CN=localhost.localdom ain/Email= root@local host.local domain (errflg=2) in
Unknown on line 0
How to solve this...Please help me....
logudotcom
i have written code for access my inbox thourgh PHP, imap function available in PHP
the code as follows
--------------------------
$MAIL_HOST="localhost";
$MAIL_USER="user";
$MAIL_PASS="pwd";
$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
htmlspecialchars($headers-
foreach ($headers as $key => $value) {
if (is_array($value)) $value = implode("\",\"", $value);
echo $key . " = " . htmlspecialchars($value);
}
}
// clean up
imap_close($inbox);
--------------------------
When I execute above code, I get the below errors:
Warning: Couldn't open stream {localhost:143}INBOX in
/var/www/html/readinbox1.p
Warning: Certificate failure for localhost: self signed certificate:
/C=--/ST=SomeState/L=SomeC
Unit/CN=localhost.localdom
Unknown on line 0
How to solve this...Please help me....
logudotcom
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.