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); 

see the documentation imap_open().


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -