[wp-hackers] wp_mail_from and wp_mail_from_name

Simon Blackbourn piemanek at gmail.com
Tue Jun 29 16:53:57 UTC 2010


Hi

I have created a wp_new_user_notification function to replace the one in
pluggable.php, to send out a welcome mail to new users with some information
& instructions.

I've added two filters to change the from name and from email address:

add_filter( 'wp_mail_from', 'mysite_from_email' );
add_filter( 'wp_mail_from_name', 'mysite_from_name' );

function mysite_from_email( $email ) {
    return "noreply at mysite.com";
}

function mysite_from_name( $name ) {
    return "The MySite website";
}

But the message is always sent from the email address of the user with the
admin role, not from the address given in the mysite_from_email function (or
even from the site email address as in get_bloginfo( 'admin_email' )).

Is this a bug or am I missing something obvious? (I'm using 3.0 and have
tried it on two different sites)

Thanks
Simon


More information about the wp-hackers mailing list