How to remove wordpress from wp mail
WP Mail is a WordPress plugin that allows you to send emails from your WordPress site. If you want to remove WordPress from the email headers, you can use the following methods:
Method 1: Using the wp_mail_from
and wp_mail_from_name
filters
You can use the wp_mail_from
and wp_mail_from_name
filters to modify the email headers. Add the following code to your theme's functions.php
file:
function remove_wp_mail_from_header($header) {
$header = str_replace('WordPress', '', $header);
return $header;
}
add_filter('wp_mail_from', 'remove_wp_mail_from_header');
add_filter('wp_mail_from_name', 'remove_wp_mail_from_header');
This code will remove the "WordPress" text from the From
and From Name
email headers.
Method 2: Using the wp_mail
action
You can use the wp_mail
action to modify the email headers. Add the following code to your theme's functions.php
file:
function remove_wp_mail_from_header($headers) {
$headers['From'] = str_replace('WordPress', '', $headers['From']);
$headers['From-Name'] = str_replace('WordPress', '', $headers['From-Name']);
return $headers;
}
add_action('wp_mail', 'remove_wp_mail_from_header', 10, 2);
This code will remove the "WordPress" text from the From
and From Name
email headers.
Method 3: Using a plugin
You can also use a plugin like "Remove WordPress from Email Headers" or "WP Mail Remove WordPress" to achieve this. These plugins provide a simple way to remove the WordPress text from the email headers.
Note: Before making any changes, make sure to test your email sending functionality to ensure that the modifications do not break your email sending functionality.