french mailbox mounted on a wall

“Oh NO! How do I change the WordPress default email sender name?? Why is this even happening?!”

That’s your reaction while you’re testing your cell phone unlock website with WooCommerce and the StockUnlocks plugin. Surprisingly, notification and status emails are being sent out that contain wordpress@yourdomain.com as the sender’s address.

You must change the WordPress default email sender name so that your customers aren’t confused. Besides, they need to reply to your support email address.

How can you change the default email sender in WordPress?

In short, here’s what you have to do change the default email sender’s name :

  • Identify the current theme you’re using
  • Create a child theme folder
  • Create a functions.php in the child theme’s folder
  • Add the functionality you need to the functions.php

The functions.php is a valuable file that enables you to add your own custom features to your WordPress theme. Moreover, you can define your own functions and access core functions of WordPress to extend your theme’s functionality.

Every theme used in WordPress has its own functions.php file. Accordingly, it’s important to know that only code found in the active theme’s function.php is actually run.

Adding a function to the child theme’s function file is a safe way to modify the parent theme. Also, when the parent theme gets updated, your functions will remain safe within the child theme, they won’t disappear.

You Need to Have a Child Theme

You need to create the functions.php file and add it to your theme’s child folder. For example, here’s an excerpt from [ How to make a WordPress Child Theme for Your Mobile Unlock Website ]:

cpanel wp-content themes directoryYou will find the parent theme in the /wp-content/themes/ folder

Let’s create a child theme for one of the WordPress default themes called “Twenty Sixteen”. You can choose any theme that you want, just make sure that you follow the pattern below.

The first thing that we need to do is create a new folder next to the “Twenty Sixteen” theme’s folder and name it twentysixteen-child.

cpanel wp-content child theme folder creationHere’s what that should look like:

/wp-content/themes/twentysixteen-child

Change the WordPress Default Email Sender

Next, create a file in the themes folder and name it functions.php:

/wp-content/themes/twentysixteen-child/functions.php

cpanel file manager new file dialogcreated the wordpress default email child theme file 

Add the following content to the functions.php file:


/* ----------------------------------------------------------------------------

* Email Sender Name

*/

// CUSTOM added [date]; Function to change email address

function youruniqueidentifier_sender_email( $original_email_address ) {

return ‘support@yourdomain.com';

}

// CUSTOM added [date]; Function to change sender name

function youruniqueidentifier_sender_name( $original_email_from ) {

return ‘YourDomain Support‘;

}

// CUSTOM added [date]; Hooking up our functions to WordPress filters
// to change the sender email address and name

add_filter( 'wp_mail_from', 'youruniqueidentifier_sender_email' );

add_filter( ‘wp_mail_from_name', 'youruniqueidentifier_sender_name' );

The WordPress Themes Handbook reminds us:

It’s important to namespace your functions with a unique name. Usually this is the name of a custom theme or plugin that you’ve created.

As can be seen, the examples above use youruniqueidentifier_ as the namespace, which should be customized based on a name you have chosen. In the same way, if you dig into the StockUnlocks plugin, you will see that suwp_ is used as the namespace.

In Summary

As shown above, if you want your users to recognize your brand and identify your unique cell phone unlocking business, the outgoing email has to reflect who you are.

It’s a good idea to change the WordPress Default Email Sender information because, unless you’ve created wordpress@yourdomain.com. However, it’s probably a non-existent email address from your website.

Additionally, your email will get blocked by many spam filters because they believe WordPress to be spam. As a result, it’s been reported that some of these emails may not even make it to the spam folder.

There are so many useful customizations that you can accomplish with the functions.php file when combined with a child theme.

Be sure to read more details about theme functions in the WordPress  Theme Handbook.

Finally, don’t forget to let us know what additional functionality you’d like to see in the StockUnlocks plugin below!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.