From 83922fa64517f8c0954b66e7c12bde1a51313310 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 27 Aug 2008 21:15:42 +0000 Subject: [PATCH] Revert part of r40107 (Revert r40042 because of regressions). The changes to UserMailer.php had nothing to do with that bug. --- includes/UserMailer.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/includes/UserMailer.php b/includes/UserMailer.php index ad550dc3b4..436b1e48b5 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -98,9 +98,10 @@ class UserMailer { * @param $subject String: email's subject. * @param $body String: email's text. * @param $replyto String: optional reply-to email (default: null). + * @param $contentType String: optional custom Content-Type * @return mixed True on success, a WikiError object on failure. */ - static function send( $to, $from, $subject, $body, $replyto=null ) { + static function send( $to, $from, $subject, $body, $replyto=null, $contentType=null ) { global $wgSMTP, $wgOutputEncoding, $wgErrorString, $wgEnotifImpersonal; global $wgEnotifMaxRecips; @@ -139,7 +140,12 @@ class UserMailer { $headers['Subject'] = wfQuotedPrintable( $subject ); $headers['Date'] = date( 'r' ); $headers['MIME-Version'] = '1.0'; - $headers['Content-type'] = 'text/plain; charset='.$wgOutputEncoding; + $headers['Content-type'] = (is_null($contentType) ? + 'text/plain; charset='.$wgOutputEncoding : $contentType); + if(is_null($contentType)) + $headers['Content-type'] = 'text/plain; charset='.$wgOutputEncoding; + else + $headers['Content-type'] = $contentType; $headers['Content-transfer-encoding'] = '8bit'; $headers['Message-ID'] = "<$msgid@" . $wgSMTP['IDHost'] . '>'; // FIXME $headers['X-Mailer'] = 'MediaWiki mailer'; @@ -170,9 +176,11 @@ class UserMailer { } else { $endl = "\n"; } + $ctype = (is_null($contentType) ? + 'text/plain; charset='.$wgOutputEncoding : $contentType); $headers = "MIME-Version: 1.0$endl" . - "Content-type: text/plain; charset={$wgOutputEncoding}$endl" . + "Content-type: $ctype$endl" . "Content-Transfer-Encoding: 8bit$endl" . "X-Mailer: MediaWiki mailer$endl". 'From: ' . $from->toString(); -- 2.20.1