jenkins-bot has submitted this change and it was merged. Change subject: Split out notification emails to a separate from address so they can be configured as specified for launch. ......................................................................
Split out notification emails to a separate from address so they can be configured as specified for launch. Part of https://bugzilla.wikimedia.org/show_bug.cgi?id=46670 Change-Id: I06a73aae95bc4b6776a0554b624eccfc4602bc65 --- M Echo.php M Notifier.php M includes/EmailBatch.php M includes/EmailBundler.php 4 files changed, 23 insertions(+), 12 deletions(-) Approvals: Bsitu: Looks good to me, approved jenkins-bot: Verified diff --git a/Echo.php b/Echo.php index 9f012e0..2be350d 100644 --- a/Echo.php +++ b/Echo.php @@ -218,6 +218,14 @@ // The organization address, the value should be defined in LocalSettings.php $wgEchoEmailFooterAddress = ''; +// The email address for both "from" and "reply to" on email notifications. +// Should be defined in LocalSettings.php +$wgNotificationSender = $wgPasswordSender; +// Name for "from" on email notifications. Should be defined in LocalSettings.php +$wgNotificationSenderName = $wgPasswordSenderName; +// Name for "reply to" on email notifications. Should be defined in LocalSettings.php +$wgNotificationReplyName = 'No Reply'; + // Use the main db if this is set to false, to use a specific external db, just // use any key defined in $wgExternalServers $wgEchoCluster = false; diff --git a/Notifier.php b/Notifier.php index 5177d0a..c2fd98b 100644 --- a/Notifier.php +++ b/Notifier.php @@ -65,7 +65,7 @@ // See if the user wants to receive emails for this category if ( $user->getOption( 'echo-subscriptions-email-' . $event->getCategory() ) ) { - global $wgEchoEnableEmailBatch, $wgEchoNotifications, $wgPasswordSender, $wgPasswordSenderName, $wgEchoBundleEmailInterval; + global $wgEchoEnableEmailBatch, $wgEchoNotifications, $wgNotificationSender, $wgNotificationSenderName, $wgNotificationReplyName, $wgEchoBundleEmailInterval; $priority = EchoNotificationController::getNotificationPriority( $event->getType() ); @@ -108,8 +108,9 @@ // send single notification if the email wasn't added to queue for bundling if ( !$addedToQueue ) { // instant email notification - $adminAddress = new MailAddress( $wgPasswordSender, $wgPasswordSenderName ); - $address = new MailAddress( $user ); + $toAddress = new MailAddress( $user ); + $fromAddress = new MailAddress( $wgNotificationSender, $wgNotificationSenderName ); + $replyAddress = new MailAddress( $wgNotificationSender, $wgNotificationReplyName ); // Since we are sending a single email, should set the bundle hash to null // if it is set with a value from somewhere else $event->setBundleHash( null ); @@ -117,7 +118,7 @@ $subject = $email['subject']; $body = $email['body']; - UserMailer::send( $address, $adminAddress, $subject, $body ); + UserMailer::send( $toAddress, $fromAddress, $subject, $body, $replyAddress ); } } diff --git a/includes/EmailBatch.php b/includes/EmailBatch.php index 8caf9b5..750b481 100644 --- a/includes/EmailBatch.php +++ b/includes/EmailBatch.php @@ -217,7 +217,7 @@ * Send the batch email */ public function sendEmail() { - global $wgPasswordSender, $wgPasswordSenderName, $wgEchoEmailFooterAddress; + global $wgNotificationSender, $wgNotificationSenderName, $wgNotificationReplyName, $wgEchoEmailFooterAddress; // global email footer $footer = wfMessage( 'echo-email-footer-default' ) @@ -247,11 +247,12 @@ $footer )->text(); - $adminAddress = new MailAddress( $wgPasswordSender, $wgPasswordSenderName ); - $address = new MailAddress( $this->mUser ); + $toAddress = new MailAddress( $this->mUser ); + $fromAddress = new MailAddress( $wgNotificationSender, $wgNotificationSenderName ); + $replyAddress = new MailAddress( $wgNotificationSender, $wgNotificationReplyName ); // @Todo Push the email to job queue or just send it out directly? - UserMailer::send( $address, $adminAddress, $subject, $body ); + UserMailer::send( $toAddress, $fromAddress, $subject, $body, $replyAddress ); } /** diff --git a/includes/EmailBundler.php b/includes/EmailBundler.php index 7b96cd6..0008de6 100644 --- a/includes/EmailBundler.php +++ b/includes/EmailBundler.php @@ -244,13 +244,14 @@ return; } - global $wgPasswordSender, $wgPasswordSenderName; + global $wgNotificationSender, $wgNotificationSenderName, $wgNotificationReplyName; - $adminAddress = new MailAddress( $wgPasswordSender, $wgPasswordSenderName ); - $address = new MailAddress( $this->mUser ); + $toAddress = new MailAddress( $this->mUser ); + $fromAddress = new MailAddress( $wgNotificationSender, $wgNotificationSenderName ); + $replyAddress = new MailAddress( $wgNotificationSender, $wgNotificationReplyName ); // Schedule a email job or just send the email directly? - UserMailer::send( $address, $adminAddress, $content['subject'], $content['body'] ); + UserMailer::send( $toAddress, $fromAddress, $content['subject'], $content['body'], $replyAddress ); } /** -- To view, visit https://gerrit.wikimedia.org/r/59640 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I06a73aae95bc4b6776a0554b624eccfc4602bc65 Gerrit-PatchSet: 5 Gerrit-Project: mediawiki/extensions/Echo Gerrit-Branch: master Gerrit-Owner: Lwelling <[email protected]> Gerrit-Reviewer: Bsitu <[email protected]> Gerrit-Reviewer: Kaldari <[email protected]> Gerrit-Reviewer: Lwelling <[email protected]> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
