From 95580b06ed29ae539bf9419a6b44cc3b82f72645 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sun, 7 Nov 2010 09:30:42 +0000 Subject: [PATCH] * (bug 25728) Added $wgPasswordSenderName to allow customise the name associed with $wgPasswordSender --- RELEASE-NOTES | 2 ++ includes/DefaultSettings.php | 16 +++++++++------- includes/User.php | 7 ++++--- includes/UserMailer.php | 4 ++-- includes/specials/SpecialEmailuser.php | 4 ++-- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 3e221d075a..1e7d12f464 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -86,6 +86,8 @@ LocalSettings.php. The specific bugs are listed below in the general notes. * The FailFunction "error handling" method has now been removed * $wgAdditionalMailParams added to allow setting extra options to mail() calls. * $wgSecureLogin & $wgSecureLoginStickHTTPS to optionaly login using HTTPS +* (bug 25728) Added $wgPasswordSenderName to allow customise the name associed + with $wgPasswordSender === New features in 1.17 === * (bug 10183) Users can now add personal styles and scripts to all skins via diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index d74d56f7f5..170fd6c1e9 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -968,16 +968,21 @@ $wgEmergencyContact = 'wikiadmin@' . $serverName; * * The address we should use as sender when a user is requesting his password. */ -$wgPasswordSender = 'MediaWiki Mail '; +$wgPasswordSender = 'apache@' . $serverName; -unset($serverName); # Don't leak local variables to global scope +unset( $serverName ); # Don't leak local variables to global scope + +/** + * Password reminder name + */ +$wgPasswordSenderName = 'MediaWiki Mail'; /** * Dummy address which should be accepted during mail send action. * It might be necessary to adapt the address or to set it equal * to the $wgEmergencyContact address. */ -$wgNoReplyAddress = 'reply@not.possible'; +$wgNoReplyAddress = 'reply@not.possible'; /** * Set to true to enable the e-mail basic features: @@ -1000,7 +1005,7 @@ $wgEnableUserEmail = true; * which can cause problems with SPF validation and leak recipient addressses * when bounces are sent to the sender. */ -$wgUserEmailUseReplyTo = false; +$wgUserEmailUseReplyTo = true; /** * Minimum time, in hours, which must elapse between password reminder @@ -1033,9 +1038,6 @@ $wgSMTP = false; */ $wgAdditionalMailParams = null; -/** For email notification on page changes */ -$wgPasswordSender = $wgEmergencyContact; - /** * True: from page editor if s/he opted-in. False: Enotif mails appear to come * from $wgEmergencyContact diff --git a/includes/User.php b/includes/User.php index 88dd4030ac..63b1a6aa73 100644 --- a/includes/User.php +++ b/includes/User.php @@ -2957,12 +2957,13 @@ class User { */ function sendMail( $subject, $body, $from = null, $replyto = null ) { if( is_null( $from ) ) { - global $wgPasswordSender; - $from = $wgPasswordSender; + global $wgPasswordSender, $wgPasswordSenderName; + $sender = new MailAddress( $wgPasswordSender, $wgPasswordSenderName ); + } else { + $sender = new MailAddress( $from ); } $to = new MailAddress( $this ); - $sender = new MailAddress( $from ); return UserMailer::send( $to, $sender, $subject, $body, $replyto ); } diff --git a/includes/UserMailer.php b/includes/UserMailer.php index 39674069c4..41a00bd046 100644 --- a/includes/UserMailer.php +++ b/includes/UserMailer.php @@ -440,7 +440,7 @@ class EmailNotification { * @private */ function composeCommonMailtext() { - global $wgPasswordSender, $wgNoReplyAddress; + global $wgPasswordSender, $wgPasswordSenderName, $wgNoReplyAddress; global $wgEnotifFromEditor, $wgEnotifRevealEditorAddress; global $wgEnotifImpersonal, $wgEnotifUseRealName; @@ -496,7 +496,7 @@ class EmailNotification { # global configuration level. $editor = $this->editor; $name = $wgEnotifUseRealName ? $editor->getRealName() : $editor->getName(); - $adminAddress = new MailAddress( $wgPasswordSender, 'WikiAdmin' ); + $adminAddress = new MailAddress( $wgPasswordSender, $wgPasswordSenderName ); $editorAddress = new MailAddress( $editor ); if( $wgEnotifRevealEditorAddress && ( $editor->getEmail() != '' ) diff --git a/includes/specials/SpecialEmailuser.php b/includes/specials/SpecialEmailuser.php index 6cc6e1d035..c098e88879 100644 --- a/includes/specials/SpecialEmailuser.php +++ b/includes/specials/SpecialEmailuser.php @@ -256,8 +256,8 @@ class SpecialEmailUser extends UnlistedSpecialPage { // This is a bit ugly, but will serve to differentiate // wiki-borne mails from direct mails and protects against // SPF and bounce problems with some mailers (see below). - global $wgPasswordSender; - $mailFrom = new MailAddress( $wgPasswordSender ); + global $wgPasswordSender, $wgPasswordSenderName; + $mailFrom = new MailAddress( $wgPasswordSender, $wgPasswordSenderName ); $replyTo = $from; } else { // Put the sending user's e-mail address in the From: header. -- 2.20.1