Fix the error in html email when pear mail_mime is missing
authorbsitu <bsitu@wikimedia.org>
Mon, 24 Jun 2013 01:06:47 +0000 (18:06 -0700)
committerbsitu <bsitu@wikimedia.org>
Mon, 24 Jun 2013 01:16:28 +0000 (18:16 -0700)
When pear package mail_mime is missing, attempt to send html email throws error:
mail() expects parameter 3 to be string, array given.  This is because the code
doesn't unset the html part of the body when falling back to text email

Change-Id: Ie8c73a481cb9003a0b43893cf4751475bdf5c690

includes/UserMailer.php

index 2a549ac..8e3f048 100644 (file)
@@ -258,6 +258,8 @@ class UserMailer {
                        wfDebug( "Assembling multipart mime email\n" );
                        if ( !stream_resolve_include_path( 'Mail/mime.php' ) ) {
                                wfDebug( "PEAR Mail_Mime package is not installed. Falling back to text email.\n" );
+                               // remove the html body for text email fall back
+                               $body = $body['text'];
                        }
                        else {
                                require_once 'Mail/mime.php';