Changeset 1654
- Timestamp:
- 08/19/08 00:58:13 (3 months ago)
- Files:
-
- trunk/bb-includes/pluggable.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/bb-includes/pluggable.php
r1653 r1654 543 543 extract( apply_filters( 'bb_mail', compact( 'to', 'subject', 'message', 'headers' ) ) ); 544 544 545 global $ phpmailer;545 global $bb_phpmailer; 546 546 547 547 // (Re)create it, if it's gone missing 548 if ( !is_object( $ phpmailer ) || !is_a( $phpmailer, 'PHPMailer' ) ) {548 if ( !is_object( $bb_phpmailer ) || !is_a( $bb_phpmailer, 'PHPMailer' ) ) { 549 549 require_once BACKPRESS_PATH . 'class.mailer.php'; 550 550 require_once BACKPRESS_PATH . 'class.mailer-smtp.php'; 551 $ phpmailer = new PHPMailer();551 $bb_phpmailer = new PHPMailer(); 552 552 } 553 553 … … 609 609 610 610 // Empty out the values that may be set 611 $ phpmailer->ClearAddresses();612 $ phpmailer->ClearAllRecipients();613 $ phpmailer->ClearAttachments();614 $ phpmailer->ClearBCCs();615 $ phpmailer->ClearCCs();616 $ phpmailer->ClearCustomHeaders();617 $ phpmailer->ClearReplyTos();611 $bb_phpmailer->ClearAddresses(); 612 $bb_phpmailer->ClearAllRecipients(); 613 $bb_phpmailer->ClearAttachments(); 614 $bb_phpmailer->ClearBCCs(); 615 $bb_phpmailer->ClearCCs(); 616 $bb_phpmailer->ClearCustomHeaders(); 617 $bb_phpmailer->ClearReplyTos(); 618 618 619 619 // From email and name … … 635 635 636 636 // Set the from name and email 637 $ phpmailer->From = apply_filters( 'bb_mail_from', $from_email );638 $ phpmailer->FromName = apply_filters( 'bb_mail_from_name', $from_name );637 $bb_phpmailer->From = apply_filters( 'bb_mail_from', $from_email ); 638 $bb_phpmailer->FromName = apply_filters( 'bb_mail_from_name', $from_name ); 639 639 640 640 // Set destination address 641 $ phpmailer->AddAddress( $to );641 $bb_phpmailer->AddAddress( $to ); 642 642 643 643 // Set mail's subject and body 644 $ phpmailer->Subject = $subject;645 $ phpmailer->Body = $message;644 $bb_phpmailer->Subject = $subject; 645 $bb_phpmailer->Body = $message; 646 646 647 647 // Add any CC and BCC recipients 648 648 if ( !empty($cc) ) { 649 649 foreach ( (array) $cc as $recipient ) { 650 $ phpmailer->AddCc( trim($recipient) );650 $bb_phpmailer->AddCc( trim($recipient) ); 651 651 } 652 652 } 653 653 if ( !empty($bcc) ) { 654 654 foreach ( (array) $bcc as $recipient) { 655 $ phpmailer->AddBcc( trim($recipient) );655 $bb_phpmailer->AddBcc( trim($recipient) ); 656 656 } 657 657 } 658 658 659 659 // Set to use PHP's mail() 660 $ phpmailer->IsMail();660 $bb_phpmailer->IsMail(); 661 661 662 662 // Set Content-Type and charset … … 670 670 // Set whether it's plaintext or not, depending on $content_type 671 671 if ( $content_type == 'text/html' ) { 672 $ phpmailer->IsHTML( true );672 $bb_phpmailer->IsHTML( true ); 673 673 } else { 674 $ phpmailer->IsHTML( false );674 $bb_phpmailer->IsHTML( false ); 675 675 } 676 676 … … 681 681 682 682 // Set the content-type and charset 683 $ phpmailer->CharSet = apply_filters( 'bb_mail_charset', $charset );683 $bb_phpmailer->CharSet = apply_filters( 'bb_mail_charset', $charset ); 684 684 685 685 // Set custom headers 686 686 if ( !empty( $headers ) ) { 687 687 foreach( (array) $headers as $name => $content ) { 688 $ phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) );688 $bb_phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) ); 689 689 } 690 690 } 691 691 692 do_action_ref_array( 'bb_phpmailer_init', array( &$ phpmailer ) );692 do_action_ref_array( 'bb_phpmailer_init', array( &$bb_phpmailer ) ); 693 693 694 694 // Send! 695 $result = @$ phpmailer->Send();695 $result = @$bb_phpmailer->Send(); 696 696 697 697 return $result;