WordPress.org

Make WordPress Core

Ticket #21074: 21074.01.diff

File 21074.01.diff, 2.8 KB (added by cnorris23, 3 years ago)
  • wp-includes/class-phpmailer.php

     
    723723  } 
    724724 
    725725  /** 
     726   * Calls actual mail() function, but in a safe_mode aware fashion 
     727   * @param string $to To 
     728   * @param string $subject Subject 
     729   * @param string $body Message Body 
     730   * @param string $headers Additional Headers 
     731   * @param string $params Params 
     732   * @access private 
     733   * @return bool 
     734   */ 
     735  private function mail_passthru($to, $subject, $body, $header, $params) { 
     736        if (ini_get('safe_mode')) { 
     737                $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subject)), $body, $header); 
     738        } else { 
     739                $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($subject)), $body, $header, $params); 
     740        } 
     741        return $rt; 
     742  } 
     743  /** 
    726744   * Sends mail using the PHP mail() function. 
    727745   * @param string $header The message headers 
    728746   * @param string $body The message body 
     
    746764      ini_set('sendmail_from', $this->Sender); 
    747765      if ($this->SingleTo === true && count($toArr) > 1) { 
    748766        foreach ($toArr as $key => $val) { 
    749           $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params); 
     767          $rt = mail_passthru($val, $this->Subject, $body, $header, $params); 
    750768          // implement call back function if it exists 
    751769          $isSent = ($rt == 1) ? 1 : 0; 
    752770          $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body); 
    753771        } 
    754772      } else { 
    755         $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params); 
     773        $rt = mail_passthru($to, $this->Subject, $body, $header, $params); 
    756774        // implement call back function if it exists 
    757775        $isSent = ($rt == 1) ? 1 : 0; 
    758776        $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, $body); 
     
    760778    } else { 
    761779      if ($this->SingleTo === true && count($toArr) > 1) { 
    762780        foreach ($toArr as $key => $val) { 
    763           $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header); 
     781          $rt = mail_passthru($val, $this->Subject, $body, $header, $params); 
    764782          // implement call back function if it exists 
    765783          $isSent = ($rt == 1) ? 1 : 0; 
    766784          $this->doCallback($isSent, $val, $this->cc, $this->bcc, $this->Subject, $body); 
    767785        } 
    768786      } else { 
    769         $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header); 
     787        $rt = mail_passthru($to, $this->Subject, $body, $header, $params); 
    770788        // implement call back function if it exists 
    771789        $isSent = ($rt == 1) ? 1 : 0; 
    772790        $this->doCallback($isSent, $to, $this->cc, $this->bcc, $this->Subject, $body);