Home  >  Article  >  CMS Tutorial  >  Does WordPress’ default email address need to be modified?

Does WordPress’ default email address need to be modified?

尚
Original
2019-07-16 16:13:422638browse

Does WordPress’ default email address need to be modified?

After WordPress is installed, a system email address and a sender will be automatically created by default. The email address is WordPress@yourblogname.com, and the sender is WordPress. Although we have set the system email address to another name in the background, the email address seen by email recipients of our blog is still WordPress@yourblogname.com, and the sender name is still WordPress, which really makes the recipients feel confused. , because no one knows whether the sender in WordPress is Zhang San or Li Si, a man or a woman. And a very important point is that emails sent from email addresses such as WordPress@yourblogname.com are very easy to be intercepted as spam or directly thrown into the trash.

In order to make your WordPress blog look more professional, it is strongly recommended to change the system default email address and its sender name. Although we cannot directly modify it in the background, we can achieve this goal through other methods. Here are a few methods for your reference.

1. Create related functions

Use a suitable text editor (do not use Windows system Notepad) to open the functions.php file in the current theme folder, and then add the following code (add Before the last ?> tag):

function new_mail_from($old) {  return 'admin@yourblogname.com'; } 
function new_mail_from_name($old) {  return 'Blog Name'; } 
add_filter('wp_mail_from', 'new_mail_from'); 
add_filter('wp_mail_from_name', 'new_mail_from_name');

2. Modify the WordPress system file

Find the class_phpmailer.php file in the folder wp-includes under the WordPress installation root directory and open it And find the following code:

public $From = 'root@localhost'; 
public $FromName = 'Root User';

Change 'root@localhost' (excluding single quotes) to your favorite email address, and change 'Root User' (excluding single quotes) Enter your desired sender name.

Tips: This method involves changes to the core files of the system. The modified files will be overwritten in the system upgrade background, and the modified results will also become invalid and need to be modified again, which is more troublesome. Therefore, it is recommended to use plug-ins. OK (next step).

3. Use plug-ins

There are many plug-ins that can set the default sending email address of the WordPress system. Here are only two plug-ins. You can directly access the WordPress plug-in library through the link to view the usage introduction, here I only provide screenshots of their settings pages.

Does WordPress’ default email address need to be modified?

Does WordPress’ default email address need to be modified?

For more wordpress related technical articles, please visit the wordpress tutorial column to learn!

The above is the detailed content of Does WordPress’ default email address need to be modified?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn