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

WordPress Trac noreply at wordpress.org
Sat Jan 26 08:20:15 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    |
-------------------------+------------------------------
Changes (by iandunn):

 * cc: ian_dunn@… (added)
 * keywords:   => has-patch
 * severity:  normal => minor


Comment:

 WP doesn't use exceptions at all, so there's nothing for it to bubble up
 to. That also means there's no precedence in core for how to handle this.

 These are the ideas I had:
 1. Return a WP_Error instead of false. That would break backwards
 compatibility, though.
 2. Issue an admin_notice. That's probably more visible than desired,
 though, and it wouldn't always be obvious when it was created or what
 event it was tied to. It could also be triggered by user A and seen by
 user B, leading to confusion.
 3. Push an entry to PHP's error_log. This seems like the best solution to
 me. One potential downside is that if display_errors is enabled, the
 warning will cause the page to crash with "Cannot modify header
 information - headers already sent". I think that's to be expected,
 though, and probably consistent with other warnings thrown elsewhere in
 core.

 I've added a patch that implements !#3.

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


More information about the wp-trac mailing list