X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=class%2Fdeliver%2FDeliver_SendMail.class.php;h=4c46ab4529f9ceea5996821cac5544e127410a86;hp=2c1632b543db22e55ea40b6b55e10e96c286bbb3;hb=c4faef335b2362c81b8ebf026d4066c12d70536c;hpb=30460a05016c7e066ad7b28df7788539e4054a99 diff --git a/class/deliver/Deliver_SendMail.class.php b/class/deliver/Deliver_SendMail.class.php index 2c1632b5..4c46ab45 100644 --- a/class/deliver/Deliver_SendMail.class.php +++ b/class/deliver/Deliver_SendMail.class.php @@ -6,7 +6,7 @@ * Delivery backend for the Deliver class. * * @author Marc Groot Koerkamp - * @copyright 1999-2009 The SquirrelMail Project Team + * @copyright 1999-2020 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail @@ -47,13 +47,13 @@ class Deliver_SendMail extends Deliver { 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'])) { @@ -62,6 +62,17 @@ class Deliver_SendMail extends Deliver { } } + /** + * 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 * @@ -86,18 +97,19 @@ class Deliver_SendMail extends Deliver { * * @param Message $message Message object containing the from address * @param string $sendmail_path Location of sendmail binary + * @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) { + 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; }