Is this PHP imap connection string wrong? -
can tell me if there wrong following code? or if problem isn't related code. seem unable connect mailserver , during execution of code responds warning: imap_open(): couldn't open stream {imap.one.com993}inbox
error in class file. , notice: unknown: host not found (#11001): imap.one.com993 (errflg=2) in unknown on line 0
below previous error.
class email { public $server; public $username; public $password; public $port; public $link; public $status; function connect($host, $port, $login, $pass){ $this->server = $host; $this->username = $login; $this->link = imap_open("{". $host . $port."}inbox", $login, $pass); if($this->link) { $this->status = 'connected'; } else { $this->error[] = imap_last_error(); $this->status = 'not connected'; } } }
index file:
<?php $email = new email(); $email->connect("imap.one.com", "993", "email@address.com", "passwordstring"); ?
you need colon (:
) between host , port because want {imap.one.com:993}inbox
, not {imap.one.com993}inbox
. fix this:
$this->link = imap_open("{". $host . ":" . $port."}inbox", $login, $pass);
Comments
Post a Comment