Fahid Javid

Fahid Javid


April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Categories


How to change default email sender in WordPress

Fahid JavidFahid Javid

I get several requests for “How to change default email sender in WordPress” to the desired ones while providing tech support for the WordPress themes.

It’s very annoying when someone gets important contact form emails as spam or simply don’t like the email address of the type wordpress@yourdomain.com (in my example it would be wordpress@fahidjavid.com) and the sender’s name would be set to “WordPress”.

Fortunately, there’s a simple way of changing this:

  1. Go to your WordPress administration panel
  2. Select Appearance > Editor
  3. On the right-hand side of your screen, you’ll see a list of WordPress files. Locate functions.php and open it.
  4. At the end of the file, copy and paste the following code, replacing username@email.com and Your Name or Your Website with the ones you want.
  5. Press Save and you’re done.
add_filter('wp_mail_from', 'new_mail_from');
add_filter('wp_mail_from_name', 'new_mail_from_name');

function new_mail_from($old)
{
    return 'username@email.com';
}

function new_mail_from_name($old)
{
    return 'Your Name or Your Website';
}

Feel free to post in comments if you face any issue to make it work.

My name is Fahid and I’m a Full-Stack WordPress Developer. I started working with WordPress community and I’m finding myself learning something new every single day.

Comments 0
There are currently no comments.