Use new support for stream options on SMTP connect, add tests for it
This commit is contained in:
parent
9cbce116dc
commit
85136af8b6
|
|
@ -1059,12 +1059,13 @@ class PHPMailer {
|
|||
/**
|
||||
* Initiates a connection to an SMTP server.
|
||||
* Returns false if the operation failed.
|
||||
* @param array $options An array of options compatible with stream_context_create()
|
||||
* @uses SMTP
|
||||
* @access public
|
||||
* @throws phpmailerException
|
||||
* @return bool
|
||||
*/
|
||||
public function SmtpConnect() {
|
||||
public function SmtpConnect($options = array()) {
|
||||
if(is_null($this->smtp)) {
|
||||
$this->smtp = new SMTP;
|
||||
}
|
||||
|
|
@ -1092,7 +1093,7 @@ class PHPMailer {
|
|||
$host = $hostinfo[1];
|
||||
$port = $hostinfo[2];
|
||||
}
|
||||
if ($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $this->Timeout)) {
|
||||
if ($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $this->Timeout, $options)) {
|
||||
try {
|
||||
if ($this->Helo) {
|
||||
$hello = $this->Helo;
|
||||
|
|
|
|||
|
|
@ -967,6 +967,9 @@ EOT;
|
|||
$this->Mail->SmtpClose();
|
||||
$this->Mail->Host = "localhost:12345;10.10.10.10:54321;".$_REQUEST['mail_host'];
|
||||
$this->assertTrue($this->Mail->SmtpConnect(), 'SMTP multi-connect failed');
|
||||
$this->Mail->SmtpClose();
|
||||
$this->Mail->Host = $_REQUEST['mail_host'];
|
||||
$this->assertTrue($this->Mail->SmtpConnect(array('socket' => array('bindto' => '0:7000'))), 'SMTP connect with options failed');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue