Adding BCC recipients

This guide will show you how to add BCC recipients to the notification email. This will be done inside a filter hook PHP function.

Step 1

Get the unique ID of your Quform form, see Finding the form ID.

Step 2

Add the following code to the wp-content/themes/YOUR_THEME/functions.php file (or create a plugin for it).

1
2
34
5
6
7
function my_add_form_bcc($mailer, $form, $attachments)
{
    $mailer->addBCC('recipient1@example.com'); 
    return $mailer;
}
add_filter('iphorm_pre_send_notification_email_2', 'my_add_form_bcc', 10, 3);
function my_add_form_bcc($mailer, $form, $attachments)
{
    $mailer->addBCC('recipient1@example.com');

    return $mailer;
}
add_filter('iphorm_pre_send_notification_email_2', 'my_add_form_bcc', 10, 3);
  • On line 3, change recipient1@example.com to the email address to set as a BCC, duplicate this line for additional recipients.
  • On line 7, change the number 2 to the unique ID of form, from Step 1

See also

For more examples of what you can do with the PHPMailer object, see http://www.ustrem.org/en/articles/send-mail-using-phpmailer-en/

Still having trouble? Head over to the forums.

Forums