Merge "Revert "Use display name in category page subheadings if provided""
[lhc/web/wiklou.git] / includes / specials / SpecialEmailuser.php
index fb1943f..06be7bc 100644 (file)
@@ -388,13 +388,29 @@ class SpecialEmailUser extends UnlistedSpecialPage {
                        // unless they are emailing themselves, in which case one
                        // copy of the message is sufficient.
                        if ( $data['CCMe'] && $to != $from ) {
-                               $cc_subject = $context->msg( 'emailccsubject' )->rawParams(
+                               $ccTo = $from;
+                               $ccFrom = $from;
+                               $ccSubject = $context->msg( 'emailccsubject' )->rawParams(
                                        $target->getName(), $subject )->text();
-
-                               // target and sender are equal, because this is the CC for the sender
-                               Hooks::run( 'EmailUserCC', [ &$from, &$from, &$cc_subject, &$text ] );
-
-                               $ccStatus = UserMailer::send( $from, $from, $cc_subject, $text );
+                               $ccText = $text;
+
+                               Hooks::run( 'EmailUserCC', [ &$ccTo, &$ccFrom, &$ccSubject, &$ccText ] );
+
+                               if ( $config->get( 'UserEmailUseReplyTo' ) ) {
+                                       $mailFrom = new MailAddress(
+                                               $config->get( 'PasswordSender' ),
+                                               wfMessage( 'emailsender' )->inContentLanguage()->text()
+                                       );
+                                       $replyTo = $ccFrom;
+                               } else {
+                                       $mailFrom = $ccFrom;
+                                       $replyTo = null;
+                               }
+
+                               $ccStatus = UserMailer::send(
+                                       $ccTo, $mailFrom, $ccSubject, $ccText, [
+                                               'replyTo' => $replyTo,
+                               ] );
                                $status->merge( $ccStatus );
                        }