I found a script for making your own contact form in your wordpress site (without plugin) Now, I want to add more clients email accounts as a BCC or CC. how can I do that?

This is me code which define the email address:

if(!isset($hasError)) {
        $emailTo = get_option('tz_email');
        if (!isset($emailTo) || ($emailTo == '') ){
            $emailTo = 'ponim@orot.ac.il';


  • How can we add this bcc email in php code for contact form 7 plugin, i m talking about php code not in plugin interface. – Smart Dev Nov 13 '15 at 19:03

If your code uses wp_mail function to send emails, then you can specify multiple recipients using an array or a comma-separated string.

So your $emailTo will be..

$emailTo = array(

If your code does not use wp_mail function then you can define multiple instance of PHP mail function.

To BCC and CC with wp_mail, you must use the $headers argument. If it's not already defined in your wp_mail then here is a simple example.

$headers[] = 'From: Me Myself <me@example.net>';
$headers[] = 'Cc: John Q Codex <jqc@wordpress.org>';
$headers[] = 'Cc: iluvwp@wordpress.org';

Although adding email addresses with array (first code) will work just fine, and unless you have a good reason to use BCC/CC headers, you should use it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.