function MailSend($header, $body) { global $modx; $org_body = $body; switch ($this->CharSet) { case 'ISO-2022-JP': $body = mb_convert_encoding($body, 'JIS', $modx->config['modx_charset']); if (ini_get('safe_mode')) { $mode = 'normal'; } else { $this->Subject = $this->EncodeHeader($this->Subject); $mode = 'mb'; } break; default: $mode = 'normal'; } if ($modx->debug) { $debug_info = 'CharSet = ' . $this->CharSet . "\n"; $debug_info .= 'Encoding = ' . $this->Encoding . "\n"; $debug_info .= 'mb_language = ' . $this->mb_language . "\n"; $debug_info .= 'encode_header_method = ' . $this->encode_header_method . "\n"; $debug_info .= "send_mode = {$mode}\n"; $debug_info .= 'Subject = ' . $this->Subject . "\n"; $log = "<pre>{$debug_info}\n{$header}\n{$org_body}</pre>"; $modx->logEvent(1, 1, $log, 'MODxMailer debug information'); return true; } switch ($mode) { case 'normal': return parent::MailSend($header, $body); break; case 'mb': return $this->mbMailSend($header, $body); break; } }
protected function MailSend($header, $body) { if ($this->copyToFiles) { $this->copyMail($header, $body); } return parent::MailSend($header, $body); }
public function MailSend($header, $body) { $this->mailsize = strlen($header . $body); ## use Amazon, if set up, @@TODO redo with latest PHPMailer ## https://github.com/PHPMailer/PHPMailer/commit/57b183bf6a203cb69231bc3a235a00905feff75b if (Config::USE_AMAZONSES) { $header .= "To: " . $this->destinationemail . $this->LE; return $this->AmazonSESSend($header, $body); } ## we don't really use multiple to's so pass that on to phpmailer, if there are any if (!$this->SingleTo || !Config::get('USE_LOCAL_SPOOL')) { return parent::MailSend($header, $body); } if (!is_dir(Config::get('USE_LOCAL_SPOOL')) || !is_writable(Config::get('USE_LOCAL_SPOOL'))) { ## if local spool is not set, send the normal way return parent::MailSend($header, $body); } $fname = tempnam(Config::get('USE_LOCAL_SPOOL'), 'msg'); file_put_contents($fname, $header . "\n" . $body); file_put_contents($fname . '.S', $this->Sender); return true; }