Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding support for passing additional socket options.

Request: 18418
  • Loading branch information...
commit 3c054fc005f98990dd7a8e9e9577379030aec86a 1 parent 2ef7e09
@jparise jparise authored
Showing with 14 additions and 2 deletions.
  1. +13 −2 SMTP.php
  2. +1 −0  package.xml
View
15 SMTP.php
@@ -106,6 +106,14 @@ class Net_SMTP
var $_socket = null;
/**
+ * Array of socket options that will be passed to Net_Socket::connect().
+ * @see stream_context_create()
+ * @var array
+ * @access private
+ */
+ var $_socket_options = null;
+
+ /**
* The socket I/O timeout value in seconds.
* @var int
* @access private
@@ -156,12 +164,13 @@ class Net_SMTP
* @param string $localhost The value to give when sending EHLO or HELO.
* @param boolean $pipeling Use SMTP command pipelining
* @param integer $timeout Socket I/O timeout in seconds.
+ * @param array $socket_options Socket stream_context_create() options.
*
* @access public
* @since 1.0
*/
function Net_SMTP($host = null, $port = null, $localhost = null,
- $pipelining = false, $timeout = 0)
+ $pipelining = false, $timeout = 0, $socket_options = null)
{
if (isset($host)) {
$this->host = $host;
@@ -175,6 +184,7 @@ function Net_SMTP($host = null, $port = null, $localhost = null,
$this->pipelining = $pipelining;
$this->_socket = new Net_Socket();
+ $this->_socket_options = $socket_options;
$this->_timeout = $timeout;
/* Include the Auth_SASL package. If the package is not
@@ -405,7 +415,8 @@ function connect($timeout = null, $persistent = false)
{
$this->_greeting = null;
$result = $this->_socket->connect($this->host, $this->port,
- $persistent, $timeout);
+ $persistent, $timeout,
+ $this->_socket_options);
if (PEAR::isError($result)) {
return PEAR::raiseError('Failed to connect socket: ' .
$result->getMessage());
View
1  package.xml
@@ -31,6 +31,7 @@
</stability>
<license uri="http://www.php.net/license/3_01.txt">PHP License</license>
<notes>- Avoid requesting immediate socket timeouts. (Bug 18335)
+- Added support for passing additional socket options. (Request 18418)
</notes>
<contents>
<dir baseinstalldir="Net" name="/">
Please sign in to comment.
Something went wrong with that request. Please try again.