| 373 | | // Add any CC and BCC recipients |
| 374 | | if ( !empty( $cc ) ) { |
| 375 | | foreach ( (array) $cc as $recipient ) { |
| 376 | | try { |
| 377 | | // Break $recipient into name and address parts if in the format "Foo <bar@baz.com>" |
| 378 | | $recipient_name = ''; |
| 379 | | if( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) { |
| 380 | | if ( count( $matches ) == 3 ) { |
| 381 | | $recipient_name = $matches[1]; |
| 382 | | $recipient = $matches[2]; |
| | 375 | // Add any CC, BCC, and Reply-To recipients |
| | 376 | foreach ( array( 'cc', 'bcc', 'reply_to' ) as $recipient_header ) { |
| | 377 | if ( ! empty( $$recipient_header ) ) { |
| | 378 | foreach ( $$recipient_header as $recipient ) { |
| | 379 | try { |
| | 380 | // Break $recipient into name and address parts if in the format "Foo <bar@baz.com>" |
| | 381 | $recipient_name = ''; |
| | 382 | if( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) { |
| | 383 | if ( count( $matches ) == 3 ) { |
| | 384 | $recipient_name = $matches[1]; |
| | 385 | $recipient = $matches[2]; |
| | 386 | } |
| 392 | | if ( !empty( $bcc ) ) { |
| 393 | | foreach ( (array) $bcc as $recipient) { |
| 394 | | try { |
| 395 | | // Break $recipient into name and address parts if in the format "Foo <bar@baz.com>" |
| 396 | | $recipient_name = ''; |
| 397 | | if( preg_match( '/(.*)<(.+)>/', $recipient, $matches ) ) { |
| 398 | | if ( count( $matches ) == 3 ) { |
| 399 | | $recipient_name = $matches[1]; |
| 400 | | $recipient = $matches[2]; |
| | 394 | case 'bcc': |
| | 395 | $phpmailer->AddBcc( $recipient, $recipient_name ); |
| | 396 | break; |
| | 397 | |
| | 398 | case 'reply_to': |
| | 399 | $phpmailer->AddReplyTo( $recipient, $recipient_name ); |
| | 400 | break; |