WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#15594 new enhancement

make pluggable the multisite/"wpmu" mails

Reported by: arena Owned by:
Milestone: Future Release Priority: normal
Severity: minor Version: 3.1
Component: Mail Keywords: needs-patch
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 3 years ago.
wp_mail use in wordpress nightly build

Download all attachments as: .zip

Change History (10)

comment:1 nacin3 years ago

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

comment:2 SergeyBiryukov3 years ago

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

comment:3 arena3 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 westi3 years ago

What specific functions do you want to see as pluggable.

This ticket is lacking in detail :-(

arena3 years ago

wp_mail use in wordpress nightly build

comment:5 arena3 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 dd323 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 westi3 years ago

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

comment:8 arena3 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 nacin3 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
Note: See TracTickets for help on using tickets.