IMAP Mail Receiver Error : Couldn't connect to server
by Nithya[ Edit ] 2010-08-25 10:02:11
<u>IMAP receive mail function</u>
function receiveMail($username,$password,$EmailAddress,$mailserver='localhost',$servertype='pop',$port='110',$ssl = false) //Constructure
{
if($servertype=='imap')
{
if($port=='') $port='143';
$strConnect='{'.$mailserver.':'.$port. '}INBOX';
}
else
{
$strConnect='{'.$mailserver.':'.$port. '/pop3'.($ssl ? "/ssl" : "").'}INBOX';
}
$this->server = $strConnect;
$this->username = $username;
$this->password = $password;
$this->email = $EmailAddress;
}
Above function is used to receive the mail and
If the error
Couldn't connect to server occurs
add
/notls.
That is
replace the line
$strConnect='{'.$mailserver.':'.$port. '/pop3'.($ssl ? "/ssl" : "").'}INBOX';
with the below line
$strConnect='{'.$mailserver.':'.$port. '/pop3'.($ssl ? "/ssl" : "").'/notls}INBOX';