[wp-trac] [WordPress Trac] #23291: wp_mail should handle phpmailer exceptions instead of ignoring them

WordPress Trac noreply at wordpress.org
Sat Jan 26 17:37:16 UTC 2013


#23291: wp_mail should handle phpmailer exceptions instead of ignoring them
-------------------------+------------------------------
 Reporter:  mark-k       |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Mail         |     Version:  3.5
 Severity:  minor        |  Resolution:
 Keywords:  has-patch    |
-------------------------+------------------------------

Comment (by iandunn):

 23291.diff pushes the error through PHP, so you can use
 [http://us.php.net/manual/en/function.set-error-handler.php
 set_error_handler( 'your-callback-function', E_USER_NOTICE )] to catch it
 and do whatever you'd like.

 Adding an action on top of that would be add a bit of unnecessary
 overhead. It wouldn't be significant in-and-of-itself, but combined with
 the hundreds of other hooks already in WP, it can add up. I don't see any
 added benefit to an extra action over just hooking into PHP's error
 handling. Does anyone else?

 We may want to add some kind of ID to the error message so that it's
 easier to distinguish from other messages, though. e.g.,

   Notice: [wp_mail] Invalid address: first.last@ in
 /var/www/vhosts/example.com/httpdocs/wp-svn-trunk/wp-
 includes/pluggable.php on line 359

 ...instead of just

   Notice: Invalid address: first.last@ in
 /var/www/vhosts/example.com/httpdocs/wp-svn-trunk/wp-
 includes/pluggable.php on line 359

 Thoughts on that?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/23291#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list