[wp-trac] [WordPress Trac] #23642: wp_mail() returns true if sending failed

WordPress Trac noreply at wordpress.org
Mon Mar 4 02:51:16 UTC 2013


#23642: wp_mail() returns true if sending failed
--------------------------+------------------------------
 Reporter:  chmac         |       Owner:
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Mail          |     Version:  3.2
 Severity:  minor         |  Resolution:
 Keywords:  has-patch     |
--------------------------+------------------------------

Comment (by iandunn):

 #23291 only returns a WP_Error when PHPMailer throws an exception -- and
 wp_mail() was called with $wp_error set to true -- so there are still
 potential cases where Send() returns false without throwing an exception
 and wp_mail() returns true.

 One thing we could easily do here is to add to the $errors array that
 #23291 creates if $wp_error is passed in as true and Send() returns false.
 That would basically be a catchall error to let the caller know something
 went wrong.

 I'm not sure what the best thing to do would be if $wp_error is passed in
 as false, though, which is the default. It seems logical to me that if
 Send() returns false, then so should wp_mail(), but that would change the
 current behavior and could break backwards compatibility for plugins, etc.
 Any thoughts on that?

 chmac, do you have any specific use cases you can share where wp_mail()
 returning true causes a problem?

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


More information about the wp-trac mailing list