| 213 | |
| 214 | /** |
| 215 | * @ticket 23642 |
| 216 | */ |
| 217 | function test_wp_mail_return_value() { |
| 218 | // No errors |
| 219 | $this->assertTrue( wp_mail( 'valid@address.com', 'subject', 'body' ) ); |
| 220 | |
| 221 | // Non-fatal errors |
| 222 | $this->assertTrue( wp_mail( 'valid@address.com', 'subject', 'body', "Cc: invalid-address\nBcc: @invalid.address", ABSPATH . '/non-existant-file.html' ) ); |
| 223 | |
| 224 | // Fatal errors |
| 225 | $this->assertFalse( wp_mail( 'invalid.address', 'subject', 'body', '', array() ) ); |
| 226 | } |
| 227 | |
| 228 | /** |
| 229 | * @ticket 23642 |
| 230 | */ |
| 231 | function test_wp_mail_return_value_with_exceptions_off() { |
| 232 | // Recreate PHPMailer with exceptions turned off, so that it will return false instead of throwing an exception |
| 233 | global $phpmailer; |
| 234 | $phpmailer = new PHPMailer( false ); |
| 235 | |
| 236 | $this->assertFalse( wp_mail( 'invalid.address', 'subject', 'body', '', array() ) ); |
| 237 | } |