Skip to content

Commit

Permalink
Don't set mail() additional_parameters to space when not being used, f…
Browse files Browse the repository at this point in the history
  • Loading branch information
Synchro committed Jun 6, 2016
1 parent 60a6453 commit 7d341c1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions class.phpmailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,9 @@ private function mailPassthru($to, $subject, $body, $header, $params)
} else {
$subject = $this->encodeHeader($this->secureHeader($subject));
}
if (ini_get('safe_mode') || !($this->UseSendmailOptions)) {
//Can't use additional_parameters in safe_mode
//@link http://php.net/manual/en/function.mail.php
if (ini_get('safe_mode') or !$this->UseSendmailOptions) {
$result = @mail($to, $subject, $body, $header);
} else {
$result = @mail($to, $subject, $body, $header, $params);
Expand Down Expand Up @@ -1425,17 +1427,17 @@ protected function mailSend($header, $body)
}
$to = implode(', ', $toArr);

if (empty($this->Sender)) {
$params = ' ';
} else {
$params = null;
//This sets the SMTP envelope sender which gets turned into a return-path header by the receiver
if (!empty($this->Sender)) {
$params = sprintf('-f%s', $this->Sender);
}
if ($this->Sender != '' and !ini_get('safe_mode')) {
$old_from = ini_get('sendmail_from');
ini_set('sendmail_from', $this->Sender);
}
$result = false;
if ($this->SingleTo && count($toArr) > 1) {
if ($this->SingleTo and count($toArr) > 1) {
foreach ($toArr as $toAddr) {
$result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params);
$this->doCallback($result, array($toAddr), $this->cc, $this->bcc, $this->Subject, $body, $this->From);
Expand Down

0 comments on commit 7d341c1

Please sign in to comment.