Page MenuHomePhabricator

Tries to send e-mails to users without an e-mail address
Closed, ResolvedPublic

Description

Author: lalinsky

Description:
When somebody edits a Talk page for an user, which doesn't have an e-mail address set in MediaWiki, it will try to send the notification e-mail to "UserName <>". This generates incorrect e-mail headers, so mail servers will usually return the message as undelivered. As an example:

From: Mail Delivery System <[email protected]>
Date: August 5, 2008 12:54:52 PM PDT
To: [email protected]
Subject: Mail failure - malformed recipient address

A message that you sent contained one or more recipient addresses
that were
incorrectly constructed:

Nikki <>: missing or malformed local part

This address has been ignored. There were no other addresses in your
message, and so no attempt at delivery was possible.

  • This is a copy of the headers that were received before the

error

was detected.

To: Nikki <>
Subject: MusicBrainz Wiki page User talk:Nikki has been changed by
CatCat
MIME-Version: 1.0
Content-type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Mailer: MediaWiki mailer
From: WikiAdmin <[email protected]>
Reply-To: [email protected]
Message-Id: <[email protected]>
Sender: ",,," <[email protected]>
X-rewrote-sender: [email protected]
Date: Tue, 05 Aug 2008 19:54:52 +0000

Ideally, MediaWiki should check if the user has an e-mail address and not try to send the e-mail if they don't.

Thanks,
Lukas


Version: 1.12.x
Severity: normal

Details

Reference
bz15055

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:20 PM
bzimport added a project: MediaWiki-Email.
bzimport set Reference to bz15055.
bzimport added a subscriber: Unknown Object (MLST).

UserMailer::actuallyNotifyOnPageChange() appears to be checking $watchingUser->isEmailConfirmed() which will return false if you don't have a valid email address set.

Do you perhaps have the user 'Nikki' set in $wgUsersNotifiedOnAllChanges? For this case the check appears to be bypassed.

lalinsky wrote:

As far I can see, $watchingUser->isEmailConfirmed() is called only for other users watching that specific page. If it's a talk page, and the user has enotifusertalkpages set to 1 (which seems to be the default according to includes/DefaultSettings.php), it unconditionally calls UserMailer::compose for that user:

				} elseif( $targetUser->getOption( 'enotifusertalkpages' ) ) {
					wfDebug( __METHOD__.": sending talk page update notification\n" );
					$this->compose( $targetUser );
					$userTalkId = $targetUser->getId();
				} else {

So it looks like this code block should be:

				} elseif( $targetUser->getOption( 'enotifusertalkpages' ) && $targetUser->isEmailConfirmed() ) {
					wfDebug( __METHOD__.": sending talk page update notification\n" );
					$this->compose( $targetUser );
					$userTalkId = $targetUser->getId();
				} else {

Aho!

That'll do it. :)

Fixed in r38746