• I installed a plugin that sends a registration message manually from its own php code. This wp_mail() with plain text is not getting changes by WP Better Emails.

    I have these lines:

    add_action('user_register', 'user_register_email');
    
    function user_register_email($user_id) {
        $user = new WP_User($user_id);
        $email = $user->user_email;
        $text = 'Hi, {%username%}!';
        $text = str_replace(array('{%username%}'), array($user->user_login), $text);
        $headers = "From: Name <[email protected]>";
        wp_mail( $email, 'Registration on '.get_bloginfo('name')', $text, $headers);
    }

    http://ww.wp.xz.cn/plugins/wp-better-emails/

Viewing 1 replies (of 1 total)
  • Plugin Author Nicolas Lemoine

    (@nlemoine)

    First, you have a syntax error on this line :

    wp_mail( $email, 'Registration on '.get_bloginfo('name')', $text, $headers);

    There is no single quote after get_bloginfo('name').

    The fixed line is like this :

    wp_mail( $email, 'Registration on '.get_bloginfo('name'), $text, $headers);

    I just tested your function on the last WordPress release and everything works fine. Make sure the plugin you use for your registration message does not change email format to text/html. Have a look at email source to check that.

Viewing 1 replies (of 1 total)

The topic ‘WP_MAIL () from PHP goes through’ is closed to new replies.