| | |
| | | if (strlen($headers['Bcc'])) |
| | | $a_recipients[] = $headers['Bcc']; |
| | | |
| | | // clean Bcc from header for recipients |
| | | $send_headers = $headers; |
| | | unset($send_headers['Bcc']); |
| | | // here too, it because txtHeaders() below use $message->_headers not only $send_headers |
| | | unset($message->_headers['Bcc']); |
| | | |
| | | $smtp_headers = $message->txtHeaders($send_headers, true); |
| | | // remove Bcc header and get the whole head of the message as string |
| | | $smtp_headers = $this->message_head($message, array('Bcc')); |
| | | |
| | | if ($message->getParam('delay_file_io')) { |
| | | // use common temp dir |
| | |
| | | } |
| | | // send mail using PHP's mail() function |
| | | else { |
| | | // unset some headers because they will be added by the mail() function |
| | | $headers_enc = $message->headers($headers); |
| | | $headers_php = $message->_headers; |
| | | unset($headers_php['To'], $headers_php['Subject']); |
| | | |
| | | // reset stored headers and overwrite |
| | | $message->_headers = array(); |
| | | $header_str = $message->txtHeaders($headers_php); |
| | | // unset To,Subject headers because they will be added by the mail() function |
| | | $header_str = $this->message_head($message, array('To', 'Subject')); |
| | | |
| | | // #1485779 |
| | | if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { |
| | | if (preg_match_all('/<([^@]+@[^>]+)>/', $headers_enc['To'], $m)) { |
| | | $headers_enc['To'] = implode(', ', $m[1]); |
| | | if (preg_match_all('/<([^@]+@[^>]+)>/', $headers['To'], $m)) { |
| | | $headers['To'] = implode(', ', $m[1]); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | else { |
| | | $delim = $this->config->header_delimiter(); |
| | | $to = $headers_enc['To']; |
| | | $subject = $headers_enc['Subject']; |
| | | $to = $headers['To']; |
| | | $subject = $headers['Subject']; |
| | | $header_str = rtrim($header_str); |
| | | |
| | | if ($delim != "\r\n") { |
| | |
| | | fclose($msg_body); |
| | | } |
| | | |
| | | $message->_headers = array(); |
| | | $message->headers($headers); |
| | | $message->headers($headers, true); |
| | | |
| | | return $sent; |
| | | } |
| | | |
| | | /** |
| | | * Return message headers as a string |
| | | */ |
| | | protected function message_head($message, $unset = array()) |
| | | { |
| | | // Mail_mime >= 1.9.0 |
| | | if (method_exists($message, 'isMultipart')) { |
| | | foreach ($unset as $header) { |
| | | $headers[$header] = null; |
| | | } |
| | | } |
| | | else { |
| | | $headers = $message->headers(); |
| | | foreach ($unset as $header) { |
| | | unset($headers[$header]); |
| | | } |
| | | $message->_headers = array(); |
| | | } |
| | | |
| | | return $message->txtHeaders($headers, true); |
| | | } |
| | | } |
| | | |
| | | |