IMAP Mail Receiver Error : Couldn't connect to server - PHP Views : 263
Tagged in : PHP
Send mail vote down 0 vote down 0
<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';
By - Nithya, On - 2010-08-25




    Login to add Comments .