note 99596 modified in function.imap-open by thiago
| From: | thiago@php.net | Date: | Wed, 25 Aug 2010 19:38:35 +0000 |
| Subject: | note 99596 modified in function.imap-open by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-172068@lists.php.net to get a copy of this message | ||
<?php
// You can break out the variables for $mailserver, $port, $user and
// $pass without passing brackets into functions this way. Be sure to use
// the dots to append connection strings, ie "stuff". $variable ."STUFF"
// otherwise will go to imap_open with wrong variable type. :)
$mailserver="mail.example.com";
$port="110/pop3";
$user="aj";
$pass="remax01";
if ($mbox=imap_open( "{" . $mailserver . ":" . $port . "}INBOX",
$user, $pass ))
{ echo "Connected\n";
$check = imap_mailboxmsginfo($mbox);
echo "Date: " . $check->Date . "<br />\n" ;
echo "Driver: " . $check->Driver . "<br />\n" ;
echo "Unread: " . $check->Unread . "<br />\n" ;
echo "Size: " . $check->Size . "<br />\n" ;
imap_close($mbox);
} else { exit ("Can't connect: " . imap_last_error() ."\n"); echo
"FAIL!\n"; };
?>
--was--
// You can break out the variables for $mailserver, $port, $user and
// $pass without passing brackets into functions this way. Be sure to use
// the dots to append connection strings, ie "stuff". $variable ."STUFF"
// otherwise will go to imap_open with wrong variable type. :)
$mailserver="webmail.seasidehighspeed.com";
$port="110/pop3";
$user="aj";
$pass="remax01";
if ($mbox=imap_open( "{" . $mailserver . ":" . $port . "}INBOX",
$user, $pass ))
{ echo "Connected\n";
$check = imap_mailboxmsginfo($mbox);
echo "Date: " . $check->Date . "<br />\n" ;
echo "Driver: " . $check->Driver . "<br />\n" ;
echo "Unread: " . $check->Unread . "<br />\n" ;
echo "Size: " . $check->Size . "<br />\n" ;
imap_close($mbox);
} else { exit ("Can't connect: " . imap_last_error() ."\n"); echo
"FAIL!\n"; };
http://php.net/manual/en/function.imap-open.php