WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 9 months ago

#15594 closed enhancement (invalid)

make pluggable the multisite/"wpmu" mails

Reported by: arena Owned by:
Milestone: Priority: normal
Severity: minor Version: 3.1
Component: Mail Keywords:
Focuses: multisite Cc:

Description

such as the one that is generated in the first lines of

wp-admin/user-new.php

Attachments (1)

wp_mail.txt (2.3 KB) - added by arena 5 years ago.
wp_mail use in wordpress nightly build

Download all attachments as: .zip

Change History (13)

comment:1 @nacin5 years ago

  • Keywords 2nd-opinion added
  • Type changed from task (blessed) to feature request

comment:2 @SergeyBiryukov5 years ago

There's a filter already, isn't it sufficient? Are there any emails without a filter?

comment:3 @arena5 years ago

in wordpress before merging with wpmu,

wp_mail function and mails are all pluggable

in wpmu that is not the case.
I think all wpmu mails should be pluggable !

comment:4 @westi5 years ago

What specific functions do you want to see as pluggable.

This ticket is lacking in detail :-(

@arena5 years ago

wp_mail use in wordpress nightly build

comment:5 @arena5 years ago

see wp_mail file attached from wordpress latest nightly build to show you that

For a mono site install, all mails are issued from wp-includes/pluggable.php except for

  • wp-login.php:233 where there is a filter : 'retrieve_password_message' that allows you to completly override the wp_mail function.
  • wp-mail.php:184: for posting posts via mails

For a multi site install none of the mails send are pluggable. Filtering the content is not enough when you want to send multipart mails (html & plaintext see MailPress plugin).
All the ms mails should be pluggable or at least have a specific filter such as in wp-login.php:233

hope this makes it clear !

Thanks

comment:6 @dd325 years ago

If i was to replace every mention of "pluggable" with "Filterable" (ie. apply_filters(..)), would that be correct arena?

Basically, not all MU-generated emails filter the content through specific filters?

Now, Before the merge, I'm assuming wpmu -didn't- filter them either?

In the meantime, you can use the generic wp_mail filter, and switch based on the passed content/subject.

comment:7 @westi5 years ago

Also possibly rather than a filter it should be an action that the default email sending function is hooked onto.

comment:8 @arena5 years ago

If i was to replace every mention of "pluggable" with "Filterable" (ie. apply_filters(..)), would that be correct arena?

Looks good to me like this is done with filter 'retrieve_password_message' in wp-login.php

	$message = apply_filters('retrieve_password_message', $message, $key);

	if ( $message && !wp_mail($user_email, $title, $message) )
		wp_die( __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') );

comment:9 @nacin4 years ago

  • Keywords multisite needs-patch added; 2nd-opinion removed
  • Milestone changed from Awaiting Review to Future Release
  • Type changed from feature request to enhancement

comment:10 @chriscct79 months ago

It seems all the emails have (and have had) filters for the content since the merge with WPMU. Am I misinterpreting something here?

comment:11 @ircbot9 months ago

This ticket was mentioned in IRC in #wordpress-dev by DrewAPicture. View the logs.

comment:12 @DrewAPicture9 months ago

  • Keywords needs-patch removed
  • Milestone Future Release deleted
  • Resolution set to invalid
  • Status changed from new to closed

It appears there may yet be at least one Multisite email contents that isn't filterable. I talked to @jeremyfelt and the consensus is to close this ticket and open new ones for individual emails as they're identified.

Note: See TracTickets for help on using tickets.