Make WordPress Core

Opened 7 years ago

Last modified 3 weeks ago

#47618 new defect (bug)

Email sent to blank address on email change for user with no previous email address

Reported by: knutsp Owned by:
Priority: normal Milestone: Awaiting Review
Component: Users Version:
Severity: minor Keywords: has-unit-tests has-patch
Cc: Focuses:

Description

  1. Install/active some email logger og logging functionality for outgoing emails
  2. Import some content from other WP site
  3. Let importer create a new username for some of that content, when prompted
  4. Edit the newly created user and add an email address
  5. Observe the email log: "To:" field is empty

Expected: No email (attempted to be) sent when previous email is blank.

Change History (3)

#1 @johnbillion
7 years ago

Out of interest, does WordPress also try to send an email to this blank email address when someone leaves a comment on a post belonging to the user? Or when the user requests a password reset?

#2 @thisismyurl
4 weeks ago

I put up a PR for this: https://github.com/WordPress/wordpress-develop/pull/12505

The email change notification is addressed to the old email, so an account created without one (the imported-user case in the report) has no recipient and the notification goes out to an empty address. The patch adds an empty-address guard to the condition that gates the send_email_change_email filter, so nothing is prepared or sent when there was no prior address. Includes a regression test.

One note: the password-change notification just above has the same shape (it's sent to the user's current address, also empty for these accounts). I scoped the patch to the email-change case in this ticket, but I'm happy to cover both if that's preferred.

#3 @thisismyurl
3 weeks ago

  • Keywords has-unit-tests has-patch added; needs-patch removed
Note: See TracTickets for help on using tickets.