Ticket #17228: 17228.diff
| File 17228.diff, 1.8 KB (added by , 15 years ago) |
|---|
-
wp-includes/pluggable.php
281 281 if ( !is_object( $phpmailer ) || !is_a( $phpmailer, 'PHPMailer' ) ) { 282 282 require_once ABSPATH . WPINC . '/class-phpmailer.php'; 283 283 require_once ABSPATH . WPINC . '/class-smtp.php'; 284 $phpmailer = new PHPMailer( );284 $phpmailer = new PHPMailer( true ); 285 285 } 286 286 287 287 // Headers … … 400 400 $to = explode( ',', $to ); 401 401 402 402 foreach ( (array) $to as $recipient ) { 403 $phpmailer->AddAddress( trim( $recipient ) ); 403 try { 404 $phpmailer->AddAddress( trim( $recipient ) ); 405 } catch ( phpmailerException $e ) { 406 return false; 407 } 404 408 } 405 409 406 410 // Set mail's subject and body … … 410 414 // Add any CC and BCC recipients 411 415 if ( !empty( $cc ) ) { 412 416 foreach ( (array) $cc as $recipient ) { 413 $phpmailer->AddCc( trim($recipient) ); 417 try { 418 $phpmailer->AddCc( trim($recipient) ); 419 } catch ( phpmailerException $e ) { 420 return false; 421 } 414 422 } 415 423 } 416 424 417 425 if ( !empty( $bcc ) ) { 418 426 foreach ( (array) $bcc as $recipient) { 419 $phpmailer->AddBcc( trim($recipient) ); 427 try { 428 $phpmailer->AddBcc( trim($recipient) ); 429 } catch ( phpmailerException $e ) { 430 return false; 431 } 420 432 } 421 433 } 422 434 … … 455 467 456 468 if ( !empty( $attachments ) ) { 457 469 foreach ( $attachments as $attachment ) { 458 $phpmailer->AddAttachment($attachment); 470 try { 471 $phpmailer->AddAttachment($attachment); 472 } catch ( phpmailerException $e ) { 473 return false; 474 } 459 475 } 460 476 } 461 477 462 478 do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) ); 463 479 464 480 // Send! 465 $result = @$phpmailer->Send(); 481 try { 482 $phpmailer->Send(); 483 } catch ( phpmailerException $e ) { 484 return false; 485 } 466 486 467 return $result;487 return true; 468 488 } 469 489 endif; 470 490