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

WordPress Trac noreply at wordpress.org
Sat Jan 26 22:37:01 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 bpetty):

 Replying to [comment:8 mark-k]:
 > Seems to me that returning WP_Error is the only real solution here,
 anything else will just be an hack around it. The only place in core which
 cares right now about the return value can be changed to expect either
 false or WP_Error so it still will be compatible with plugins which
 override wp_mail, and we are early enough in 3.6 cycle to let authors of
 plugins that use wp_mail know about the change and prepare for it.

 This is not how compatibility is maintained in WordPress. This can't be
 changed, and that's just the way it is unfortunately. There are other
 perfectly acceptable solutions that remain backwards compatible anyway.
 Sure, it would have been nice if wp_mail() was originally designed to
 return WP_Error, but it wasn't, and it never will now (unless you want to
 start a discussion about changing the deprecation and API compatibility
 policies, but that's outside the scope of this issue).

 All that aside though, there's plenty of perfectly acceptable ways to
 validate an email address '''before''' calling `wp_mail()`, and I'm fairly
 certain most locations that call `wp_mail()` do that already as any
 properly written code should when written for an application that doesn't
 support exceptions.

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


More information about the wp-trac mailing list