[wp-hackers] wp_mail_from and wp_mail_from_name

William Canino william.canino at googlemail.com
Tue Jun 29 17:31:27 UTC 2010


Looking at the source of wp_mail() in pluggable.php (
http://svn.automattic.com/wordpress/tags/3.0/wp-includes/pluggable.php
), I suspect another plugin or function is overriding wp_mail_from and
wp_mail_from_name on your site.  If nothing is overriding it and you
didn't make pass any headers to wp_mail, WordPress always sends the
message from "WordPress <wordpress at yourdomain.com>".

W

On 29/06/2010, Simon Blackbourn <piemanek at gmail.com> wrote:
> 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
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list