Permalink
Browse files

Adding a new command() method for sending arbitrary SMTP commands.

  • Loading branch information...
1 parent 83a9dc2 commit abe5820f9cb06b4a562a8227d7cdd7911a150909 @jparise jparise committed Apr 26, 2011
Showing with 28 additions and 4 deletions.
  1. +25 −0 SMTP.php
  2. +3 −4 package.xml
View
@@ -370,6 +370,31 @@ function _parseResponse($valid, $later = false)
}
/**
+ * Issue an SMTP command and verify its response.
+ *
+ * @param string $command The SMTP command string or data.
+ * @param mixed $valid The set of valid response codes. These
+ * may be specified as an array of integer
+ * values or as a single integer value.
+ *
+ * @return mixed True on success or a PEAR_Error object on failure.
+ *
+ * @access public
+ * @since 1.6.0
+ */
+ function command($command, $valid)
+ {
+ if (PEAR::isError($error = $this->_put($command))) {
+ return $error;
+ }
+ if (PEAR::isError($error = $this->_parseResponse($valid))) {
+ return $error;
+ }
+
+ return true;
+ }
+
+ /**
* Return a 2-tuple containing the last response from the SMTP server.
*
* @return array A two-element array: the first element contains the
View
@@ -22,16 +22,15 @@
<date>2011-04-16</date>
<time>18:25:00</time>
<version>
- <release>1.5.2</release>
- <api>1.1.3</api>
+ <release>1.6.0</release>
+ <api>1.2.0</api>
</version>
<stability>
<release>stable</release>
<api>stable</api>
</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>- Adding a new command() method for sending arbitrary SMTP commands.
</notes>
<contents>
<dir baseinstalldir="Net" name="/">

0 comments on commit abe5820

Please sign in to comment.