- if (is_array( $wgSMTP )) {
- $found = false;
- $pathArray = explode( PATH_SEPARATOR, get_include_path() );
- foreach ( $pathArray as $path ) {
- if ( file_exists( $path . DIRECTORY_SEPARATOR . 'Mail.php' ) ) {
- $found = true;
- break;
- }
+ if ( $wgEnotifImpersonal ) {
+ $headers['To'] = 'undisclosed-recipients:;';
+ }
+ else {
+ $headers['To'] = implode( ", ", $dest );
+ }
+
+ if ( $replyto ) {
+ $headers['Reply-To'] = $replyto->toString();
+ }
+ $headers['Subject'] = self::quotedPrintable( $subject );
+ $headers['Date'] = date( 'r' );
+ $headers['MIME-Version'] = '1.0';
+ $headers['Content-type'] = ( is_null( $contentType ) ?
+ 'text/plain; charset=UTF-8' : $contentType );
+ $headers['Content-transfer-encoding'] = '8bit';
+
+ $headers['Message-ID'] = self::makeMsgId();
+ $headers['X-Mailer'] = 'MediaWiki mailer';
+ $headers['From'] = $from->toString();
+
+ $ret = wfRunHooks( 'AlternateUserMailer', array( $headers, $to, $from, $subject, $body ) );
+ if ( $ret === false ) {
+ return Status::newGood();
+ } else if ( $ret !== true ) {
+ return Status::newFatal( 'php-mail-error', $ret );
+ }
+
+ if ( is_array( $wgSMTP ) ) {
+ if ( function_exists( 'stream_resolve_include_path' ) ) {
+ $found = stream_resolve_include_path( 'Mail.php' );
+ } else {
+ $found = Fallback::stream_resolve_include_path( 'Mail.php' );