mirror of
https://github.com/retailcrm/Fetch.git
synced 2024-11-28 21:46:02 +03:00
Merge pull request #44 from dangerous/master
Allow the passing of connection parameters to imap_open()
This commit is contained in:
commit
413fc24ba1
@ -93,6 +93,13 @@ class Server
|
||||
*/
|
||||
protected $options = 0;
|
||||
|
||||
/**
|
||||
* This is the set of connection parameters
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $params = array();
|
||||
|
||||
/**
|
||||
* This is the resource connection to the server. It is required by a number of imap based functions to specify how
|
||||
* to connect.
|
||||
@ -225,6 +232,16 @@ class Server
|
||||
$this->options = $bitmask;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is used to set connection parameters
|
||||
*
|
||||
* @param string $key
|
||||
* @param string $value
|
||||
*/
|
||||
public function setParam($key, $value) {
|
||||
$this->params[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function gets the current saved imap resource and returns it.
|
||||
*
|
||||
@ -288,7 +305,7 @@ class Server
|
||||
if (!imap_reopen($this->imapStream, $this->getServerString(), $this->options, 1))
|
||||
throw new \RuntimeException(imap_last_error());
|
||||
} else {
|
||||
$imapStream = imap_open($this->getServerString(), $this->username, $this->password, $this->options, 1);
|
||||
$imapStream = imap_open($this->getServerString(), $this->username, $this->password, $this->options, 1, $this->params);
|
||||
|
||||
if ($imapStream === false)
|
||||
throw new \RuntimeException(imap_last_error());
|
||||
|
Loading…
Reference in New Issue
Block a user