To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > PHP Help > Newbies

Newbies Help for those who are just getting started

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 03-10-2010, 09:57 AM   #1
spinacia
Member
 
Join Date: Jul 2008
Posts: 4
Adding a static BCC email address to a PHP mailer

Hi,

I have a PHP application that uses a PHP mailer to send email messages. I would like to modify the attached PHP mailer file to add a BCC email address to every email message sent out by the PHP mailer.

Please help with instructions on which line(s) should be edited or added.

Thanks.
Attached Files
File Type: zip phpmailer.zip (9.6 KB, 18 views)
spinacia is offline   Reply With Quote
Old 03-10-2010, 10:46 AM   #2
halojoy
phpMaster
 
Join Date: Jun 2005
Location: Europe
Posts: 2,991
This function add a value to bcc
PHP Code:
    /**
     * Adds a "Bcc" address. Note: this function works
     * with the SMTP mailer on win32, not with the "mail"
     * mailer.  
     * @param string $address
     * @param string $name
     * @return void
     */
    
function AddBCC($address, $name = "") {
        
$cur = count($this->bcc);
        
$this->bcc[$cur][0] = trim($address);
        
$this->bcc[$cur][1] = $name;
    }
See the note says function wont work SMTP mailer on windows.

But to see if it doesnt work for, after all, you can add a default value of $this->bcc into the Class.
Should be like:
array('hurry_jones56@googlemail.com', 'Harry Jones')

At least I think you should make a try. It might work!
In the class.phpmailer.php this is where we should put it.
It is in Line 215
PHP Code:
    /**#@+
     * @access private
     */
    
var $smtp            = NULL;
    var
$to              = array();
    var
$cc              = array();
    var
$bcc             = array('hurry_jones56@googlemail.com', 'Harry Jones');
    var
$ReplyTo         = array();
    var
$attachment      = array();
    var
$CustomHeader    = array();
    var
$message_type    = "";
    var
$boundary        = array();
    var
$language        = array();
    var
$error_count     = 0;
    var
$LE              = "\n";
    
/**#@-*/
    
    /////////////////////////////////////////////////
    // VARIABLE METHODS
    /////////////////////////////////////////////////
__________________
--
Wish you all a Good 2010

Last edited by halojoy; 03-10-2010 at 10:51 AM.
halojoy is offline   Reply With Quote
Old 03-10-2010, 11:23 AM   #3
spinacia
Member
 
Join Date: Jul 2008
Posts: 4
Hi halojoy,

Thank you so much for the quick reply. Your soultion should work and I had applied it. Unfortunatly there is a problem (possibly with the script itself).

The BCC message is bounced back as the script tries to send the message to a bad email address. It seems the script strips the entire email address and tries to send the message to an email address that is the first letter of the email address. For example, if the email address was john@gmail.com then the script tries to send the BCC message to an email address that is J .

Without debuging the script, is there a "brute force" way to add the BCC address?

Thank.
spinacia is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 07:33 AM.








Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.