[wp-trac] [WordPress Trac] #53906: wp_mail_content_type doesn't work with pluggable function wp_mail
WordPress Trac
noreply at wordpress.org
Tue Aug 10 09:24:16 UTC 2021
#53906: wp_mail_content_type doesn't work with pluggable function wp_mail
--------------------------+-----------------------------
Reporter: skarabeq | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Mail | Version: 5.8
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
I have created my own plugin that overrides the Pluggable function
wp_mail, but into the variable {{{$message}}}, it is "text/plain". I have
tried to add a filter to change it to "text/html", but it doesn't work.
Here is the code of the plugin:
{{{#!php
<?php
/**
Plugin Name: wp_mail override
Description: Example plugin wp_mail override
Author: Example
Version: 1.0
Author URI: https://example.com
*/
function xxxx_set_content_type( $content_type ) {
return 'text/html';
}
add_filter('wp_mail_content_type', 'xxxx_set_content_type' );
if (!function_exists('wp_mail')) {
function wp_mail( $to, $subject, $message, $headers = '', $attachments
= [] )
{
var_dump($message);
}
}
}}}
When this plugin is active and I have to try to reset my password I have
the following text into a variable {{{$message}}}:
`Someone has requested a password reset for the following account: Site
Name: example Username: exampleUser If this was a mistake, ignore this
email and nothing will happen. To reset your password, visit the following
address: http://local-env.dev/wp-
login.php?action=rp&key=8CC4r2GttU32W5njL0AU&login=exampleUser&wp_lang=en_US
This password reset request originated from the IP address 127.0.0.1. `
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53906>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list