Sending email displays Wordpress as sender

后端 未结 1 1539
感情败类
感情败类 2021-01-28 00:20

I set up an emailform in PHP and send it through WORDPRESS. I thought I had everything covered but apparently it keeps displaying WORDPRESS as the sender instead of

1条回答
  •  隐瞒了意图╮
    2021-01-28 00:42

    Add a wp_mail_from_name filter as described in docs to set the sender name.

    add_filter( 'wp_mail_from_name', 'custom_wp_mail_from_name' );
    function custom_wp_mail_from_name( $original_email_from ) {
        return 'MyWebSite';
    }
    

    Or if you want to automatically substitute a site name

    add_filter( 'wp_mail_from_name', 'custom_wp_mail_from_name' );
    function custom_wp_mail_from_name( $original_email_from ) {
        return get_option('blogname');;
    }
    

    0 讨论(0)
提交回复
热议问题