WordPress.org

Make WordPress Core

Opened 17 months ago

Last modified 16 months ago

#49564 new feature request

Allow developers to set mail headers in wpmu_welcome_user_notification function

Reported by: ionvv Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version:
Component: Networks and Sites Keywords: has-patch
Focuses: multisite Cc:

Description

Hi,

with multisite, when using update_welcome_user_email hook to change the email content it's not possible to send the email in HTML format because the header is hardcoded, see line 1700 in ms-functions.php https://core.trac.wordpress.org/browser/tags/5.3/src/wp-includes/ms-functions.php#L1700

Maybe we can change the following:

 $message_headers = "From: \"{$from_name}\" <{$admin_email}>\n" . 'Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . "\"\n";

to

$message_headers[] = "From: \"{$from_name}\" <{$admin_email}>\n";
$message_headers[] = 'Content-Type: text/plain; charset="' . get_option( 'blog_charset' ) . "\"\n";
$message_headers = apply_filters( 'update_welcome_user_headers', $message_headers );

which will allow developers to filter headers with update_welcome_user_headers

Let me know what you think about it.

Warm regards,
Ion

Attachments (1)

49564.diff (2.0 KB) - added by donmhico 16 months ago.

Download all attachments as: .zip

Change History (3)

#1 @ionvv
17 months ago

  • Summary changed from Allow users to set mail headers in wpmu_welcome_user_notification function to Allow developers to set mail headers in wpmu_welcome_user_notification function

@donmhico
16 months ago

#2 @donmhico
16 months ago

Hello @ionvv,

Thanks for the ticket and for including a solution. I made a patch 49564.diff from your proposed solution and added docs

Note: See TracTickets for help on using tickets.