WordPress Change Default Sender Email Address

Posted in:
Update time:2023-11-23

We offer WordPress Themes and Plugins Custom Development Services

This site has long undertaken WordPress themes, plugins, WooCommerce-based store mall development business. We have 10 years of experience in WordPress development, if you want to Developing Websites with WordPress, please contact WeChat: iwillhappy1314 or email: amos@wpcio.com for inquiries.

2 thoughts on “WordPress 修改默认的发件人邮箱地址

  1. 今天配置好了POSTFIX,然后默认发邮件的地址就是WORDPRESS@我的域名.com,百度了半天了,一个也没成功!只GOOGLE了一下,就找到你的博客,然后一试代码OK!!!

    P。S。,百度上的代码:

    //change WordPress default mail_from information
    function new_from_name($email){
        $wp_from_name = get_option('blogname');
        return $wp_from_name;
    }
    function new_from_email($email) {
        $wp_from_email = get_option('admin_email');
        return $wp_from_email;
    }
    add_filter('wp_mail_from_name', 'new_from_name');
    add_filter('wp_mail_from', 'new_from_email');

    不知道为什么上面的不能用,而你的代码可以!

    1. 注意其中的get_option(‘blogname’)和get_option(‘admin_email’),这个用的是设置中的博客名称和管理员邮件,我的代码中是直接写死的。如果是自己用,我的代码直接一点,如果是给别人用,你贴的代码方便一点。

发表回复

Your email address will not be published. 必填项已用 * 标注

*