* Delivery backend for the Deliver class.
*
* @author Marc Groot Koerkamp
- * @copyright 1999-2015 The SquirrelMail Project Team
+ * @copyright 1999-2021 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package squirrelmail
var $sendmail_command = '';
/**
- * Constructor function
+ * Constructor (PHP5 style, required in some future version of PHP)
* @param array configuration options. array key = option name,
* array value = option value.
* @return void
* @since 1.5.1
*/
- function Deliver_SendMail($params=array()) {
+ function __construct($params=array()) {
if (!empty($params) && is_array($params)) {
// set extra sendmail arguments
if (isset($params['sendmail_args'])) {
}
}
+ /**
+ * Constructor (PHP4 style, kept for compatibility reasons)
+ * @param array configuration options. array key = option name,
+ * array value = option value.
+ * @return void
+ * @since 1.5.1
+ */
+ function Deliver_SendMail($params=array()) {
+ self::__construct($params);
+ }
+
/**
* function preWriteToStream
*
*
* @param Message $message Message object containing the from address
* @param string $sendmail_path Location of sendmail binary
- * @param mixed $ignore Eight extra arguments that the parent class
- * requires which are not used here
+ * @param mixed $ignore_x Eight extra arguments that the parent class
+ * requires which are not used here
* @return resource
* @access public
*/
- function initStream($message, $sendmail_path, $ignore=0, $ignore='', $ignore='', $ignore='', $ignore='', $ignore=false, $ignore='', $ignore=array()) {
+ function initStream($message, $sendmail_path, $ignore_1=0, $ignore_2='', $ignore_3='', $ignore_4='', $ignore_5='', $ignore_6=false, $ignore_7='', $ignore_8=array()) {
$rfc822_header = $message->rfc822_header;
$from = $rfc822_header->from[0];
$envelopefrom = trim($from->mailbox.'@'.$from->host);
- $envelopefrom = str_replace(array("\0","\n"),array('',''),$envelopefrom);
// save executed command for future reference
- $this->sendmail_command = "$sendmail_path $this->sendmail_args -f$envelopefrom";
+ $this->sendmail_command = escapeshellcmd("$sendmail_path $this->sendmail_args -f") . escapeshellarg($envelopefrom);
// open process handle for writing
- $stream = popen (escapeshellcmd($this->sendmail_command), "w");
+ $stream = popen($this->sendmail_command, "w");
return $stream;
}