• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Startup Hero

The Official Blog Of Name Hero

Learn To Fly Above The Competition Get Started
  • HomeWelcome
  • CoursesVideo Training Center
  • About UsWhat is StartupHero?
  • BlogGet the latest
  • Start HereStartup 101
  • SpeakingPodcast & Media
  • ResourcesTools to help You
    • Reselling WordPress Hosting
    • Resell Hero
    • How To Start A Blog
  • NameHeroCloud Web Hosting

How To Make WordPress Send E-mail From Another Address

By Bhagwad Park on January 9, 2023 0

How To Make WordPress Send E-mail From Another Address

WordPress sends us notifications – comment form submissions, plugin and theme updates, site updates, and more. Moreover, many plugins use the WordPress mailing subsystem so that you can receive all kinds of e-mails. And not just you as the administrator, but your users as well, and maybe even your subscribers. So it’s essential to know and, if necessary, customize the e-address and name WordPress uses for e-mails. Here’s a simple way to do it.

Default WordPress E-mail Name and Address

By default, WordPress uses the “wordpress” username and your domain name to send an e-mail. So if your site is “example.com“, the e-mail address that WordPress would use to send notifications is “[email protected]”. The sender’s name is “WordPress”.

Note that this default e-mail – [email protected] doesn’t exist! It’s just a placeholder for standard e-mails, and WordPress doesn’t assume that any of them will require a response. You can see why we would want to change it to something else.

We Want to Allow Users to Respond

Since the default “[email protected]” e-mail doesn’t exist, users won’t be able to reply to these messages. Usually, they don’t need to, and notification messages don’t require a response. But if you have a system that sends notices to regular users, for whatever reason, then you might want the ability for them to hit the “Reply” button so they can contact you.

Plus, even if no one wants to respond, it just looks better for an e-mail to come from an actual organization or person instead of from a generic application.

Code to Change the WordPress E-mail ID and Name

You can use many plugins to change WordPress’s e-mail for notifications. But I find the easiest way is to use this snippet of code in your functions.php:

function change_wordpress_email( $email ) {
    return '[email protected]';
}
 
function change_wordpress_name( $name) {
    return 'Bhagwad Park';
}
 
add_filter( 'wp_mail_from', 'change_wordpress_email' );
add_filter( 'wp_mail_from_name', 'change_wordpress_name' );

If you don’t know how to add this code, then refer to my tutorial on how to add code to WordPress using a custom plugin. It’s invaluable and will help you in the future to extend WordPress without tying yourself down to a given theme, and it’s also safer than messing with your theme’s functions.php.

This does two things:

  1. Replaces your e-mail address
  2. Returns the name WordPress uses in the “From” field

The above code uses my name and e-mail ID, so you should change it to whatever is appropriate for your website.

Ensuring that the E-mail Goes Through

A further challenge is ensuring that the e-mail WordPress sends with the new credentials reaches the recipient. There are two dangers:

  1. The receiving server will reject the mail entirely
  2. It will go to spam

Major e-mail providers like Gmail require you to create an SPF record on your DNS servers to specify which domain names are allowed to send e-mails on your behalf. So make sure you follow that tutorial. Another thing you should do is to ensure that the new e-mail ID uses the same domain name as the one on which your WordPress site resides.

If you want, you can replace the above “change_wordpress_email” function with the one below, which automatically extracts the domain name from the current WordPress “From” address and lets you input only the username:

function change_wordpress_email( $email ) {
	$parts = explode( '@', $email );
	return '[email protected]' . $parts[1];
}

In the above code, you don’t need to specify the domain name – just the first part of the e-mail ID.

There’s no good reason to retain the regular WordPress e-mail ID and name for the notifications your site sends. Instead, change it to something that not only looks professional but to which users can also respond if necessary.

Bhagwad Park Profile Picture
Bhagwad Park

I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!

Reader Interactions

Leave a Reply Cancel reply

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

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

Primary Sidebar

Connect With Us!

Superhero Resources

Fix Common Issues

  • How To Setup Free And Automatic SSL Certificates
  • How To Setup Cloudflare With Railgun
  • How To Fix Memory Exhausted Errors In WordPress
  • How To Edit PHP Version/Upload Limit/Add Extensions
  • How To Move/Migrate Your Business To Name Hero

Free Guides

  • How To Setup NameHero Hosting
  • How To Create A Web Hosting Business With WordPress
  • How To Start A WordPress Blog
  • How To Migrate WordPress To A VPS
  • How To Speed Test And Optimize Your WordPress Website
  • Magento 2.X Installation Guide
  • How To Clean Up A WordPress Hack

Training

Recent Posts

  • The Best WordPress Plugin To Combat Plagiarism
  • Is It Time to Bring Back Blog Comments?
  • Two Filters That No Longer Work In Gutenberg (And Workarounds)
  • Migrating To The New Cloudflare Managed Rules Interface
  • How To Sort Posts By The “Last Modified” Date
  • How To Make WordPress Send E-mail From Another Address
Subscribe in a reader
  • Web Hosting
  • WordPress Hosting
  • Reseller Hosting
  • VPS Hosting
  • Twitter
  • Facebook
  • LinkedIn
  • YouTube
  • FTC Disclosure
  • Earnings Disclosure
  • Privacy Policy

Copyright © 2023 · Smart Passive Income Pro on Genesis Framework · WordPress · Log in