Need to add a 'cc' and 'bcc' to the contact form

1 reply · opened Aug 2, 2017

HHOMEMAKERS_2015Aug 2, 2017

Hi there,

Your template works great! Thank you! A constant subject that I need to deal with is how to add a 'cc' and a 'bcc' to your contact form. Please can you advise where on the sendemail.php I need to add the additional code to? I have tried to add it to this section:

$toemails[] = array(

		        'email' => 'johan@homemakers-sa.co.za', // Your Email Address

			'name' => 'Mark Shelley' // Your Name

		);

and this section

$botcheck = $_POST['template-contactform-botcheck'];

	if( $botcheck == '' ) {

		$mail->SetFrom( $email , $name );

		$mail->AddReplyTo( $email , $name );

		foreach( $toemails as $toemail ) {

			$mail->AddAddress( $toemail['email'] , $toemail['name'] );

		}

		$mail->Subject = $subject;

		$name = isset($name) ? "Name: $name<br><br>" : '';

		$email = isset($email) ? "Email: $email<br><br>" : '';

		$phone = isset($phone) ? "Phone: $phone<br><br>" : '';

		$message = isset($message) ? "Message: $message<br><br>" : '';

But nothing is working. Please can you advise? Here is my link:
http://www.canvascorp.co.za/

Thanks for your time in advance
Colleen

SSemicolon WebSTAFFAug 4, 2017

Hello,

Thank You so much for the Kind Words!

You can simply add the following codes just after the $mail->AddReplyTo( $email , $name ); Line in the include/sendemail.php File:

$mail->addCC('cc@example.com');
$mail->addBCC('bcc@example.com');

This will definitely work fine. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard