[wp-hackers] Bug in wp_mail
Peter Westwood
peter.westwood at ftwr.co.uk
Sun Feb 21 21:49:10 UTC 2010
On 21 Feb 2010, at 21:07, Ron Guerin wrote:
> I think something else must be wrong in addition, since WP is
> overriding PHP's explicit sendmail_from , which it seems to me should
> be a workaround for a mere failure to set the sender.
>
> I have patched the bug locally by adding (wp-includes/pluggable.php)
>
> // Plugin authors can override the potentially troublesome default
> $phpmailer->From = apply_filters( 'wp_mail_from', $from_email );
> $phpmailer->FromName = apply_filters( 'wp_mail_from_name',
> $from_name );
> + $phpmailer->Sender = $from_email;
>
> ... but this will be overwritten at next upgrade, and I'm guessing the
> problem really needs something more than that as a proper fix.
>
This has been discussed at length in the past:
http://core.trac.wordpress.org/ticket/5007
http://core.trac.wordpress.org/ticket/5294
Basically, what we have at the moment works best for the largest percentage of end-users.
If you want to for sender to be set the same as $from_email then the follow (untested) plugin should do the trick.
<?php
/*
* Plugin Name: pjw-wp-phpmailer-sender-equals-from
* Version: 0.1
* Plugin URI: http://blog.ftwr.co.uk/#
* Description: Set the sender on PHPMailer to be the same as From
* Author: Peter Westwood
* Author URI: http://blog.ftwr.co.uk/
**/
add_action('phpmailer_init', 'pjw_phpmailer_init');
function pjw_phpmailer_init($php_mailer) {
$php_mailer->Sender = $phpmailer->From;
}
?>
Cheers
Peter
--
Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5
More information about the wp-hackers
mailing list