How to change a WordPress site’s default email sender details without changing the administrator email

Background

In WordPress, the administrator’s email address is used as the default “from” address when sending system emails, such as password resets, new user registrations, comment notifications, and others.

When WordPress sends an email, it uses the following criteria to determine the “from” address and “from” name:

  1. From Address: The administrator email address. This email address is set in your WordPress settings (Settings > General > Email Address).
  2. From Name: The name of your website. This name is set in your WordPress settings (Settings > General > Site Title).

Solution

To change the default email sender details in WordPress without changing the administrator email, you can use code snippets or plugins. Here’s how to do it using both methods:

Method 1: Using a plugin

Have a WordPress email problem right now? Ask us about it.

We’ll attempt to publish a solution ASAP for free. Challenge us!

So we can notify you when we publish a solution

If you prefer using a plugin instead of modifying code, there are several plugins available that can help you modify the default email sender details. One such plugin is WP Change Email Sender.

Here’s how to use it to change the email sender details:

  1. Install and activate the “WP Change Email Sender” plugin from your WordPress dashboard.
  2. After activation, navigate to Settings > General and scroll down to WP Change Default Mail Sender.

  1. In the “From Email” field, enter the email address you want to use as the default sender.
  2. In the “From Name” field, enter the name you want to appear as the default sender.
  3. Save your settings by clicking the “Save Changes” button at the bottom of the page.

Now, the default sender email address and name will be changed to the ones you’ve set in the plugin settings, without affecting the administrator email.

Method 2: Using a code snippet

You can use the wp_mail_from and wp_mail_from_name filters to change the sender’s email address and name.

Best ways to add custom code to WordPress
There are times you might want to add a code snippet to your WordPress site. It’s important you do this is a way that is both safe (not likely to break your
nanopo.st

Add the following code to your theme’s functions.php file or a custom plugin file:

function custom_wp_mail_from( $original_email_address ) {
    return '[email protected]'; // Replace with your desired email address
}
add_filter( 'wp_mail_from', 'custom_wp_mail_from' );

function custom_wp_mail_from_name( $original_email_from ) {
	return 'Your Name'; // Replace with your desired sender's name
}
add_filter( 'wp_mail_from_name', 'custom_wp_mail_from_name' );

Remember to replace the placeholders with the actual sender details you want to use.

Leave a Reply

Your email address will not be published. Required fields are marked *