cvs: php4 /pear/Mail sendmail.php
| From: | Chuck Hagenbuch | Date: | Fri, 10 Aug 2001 16:28:52 +0000 |
| Subject: | cvs: php4 /pear/Mail sendmail.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-460@lists.php.net to get a copy of this message | ||
chagenbu Fri Aug 10 12:28:52 2001 EDT
Modified files:
/php4/pear/Mail sendmail.php
Log:
Add support for extra command line parameters to sendmail
Index: php4/pear/Mail/sendmail.php
diff -u php4/pear/Mail/sendmail.php:1.7 php4/pear/Mail/sendmail.php:1.8
--- php4/pear/Mail/sendmail.php:1.7 Wed Aug 8 20:53:56 2001
+++ php4/pear/Mail/sendmail.php Fri Aug 10 12:28:52 2001
@@ -22,17 +22,25 @@
* Sendmail implementation of the PEAR Mail:: interface.
* @access public
* @package Mail
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
*/
class Mail_sendmail extends Mail {
/**
- * The location of the sendmail binary on the filesystem.
+ * The location of the sendmail or sendmail wrapper binary on the
+ * filesystem.
* @var string
*/
var $sendmail_path = '/usr/sbin/sendmail';
/**
+ * Any extra command-line parameters to pass to the sendmail or
+ * sendmail wrapper binary.
+ * @var string
+ */
+ var $sendmail_args = '';
+
+ /**
* Constructor.
*
* Instantiates a new Mail_sendmail:: object based on the parameters
@@ -40,6 +48,9 @@
* sendmail_path The location of the sendmail binary on the
* filesystem. Defaults to '/usr/sbin/sendmail'.
*
+ * sendmail_args Any extra parameters to pass to the sendmail
+ * or sendmail wrapper binary.
+ *
* If a parameter is present in the $params array, it replaces the
* default.
*
@@ -50,6 +61,7 @@
function Mail_sendmail($params)
{
if (isset($params['sendmail_path'])) $this->sendmail_path =
$params['sendmail_path'];
+ if (isset($params['sendmail_args'])) $this->sendmail_args =
$params['sendmail_args'];
}
/**
@@ -94,7 +106,7 @@
$result = 0;
if (@is_executable($this->sendmail_path)) {
$from = escapeShellCmd($from);
- $mail = popen($this->sendmail_path . " -f$from -- $recipients",
'w');
+ $mail = popen($this->sendmail_path . (!empty($this->sendmail_args) ? '
' . $this->sendmail_args : '') . " -f$from -- $recipients",
'w');
fputs($mail, $text_headers);
fputs($mail, "\n"); // newline to end the headers section
fputs($mail, $body);
@@ -103,7 +115,6 @@
return new PEAR_Error('sendmail [' . $this->sendmail_path . '] not
executable');
}
- // Return.
if ($result != 0) {
return new PEAR_Error('sendmail returned error code ' . $result);
}