Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #328845

    I found one thread from 2013 that had some instructions to do this, but the files have changed and so the fix no longer seems to apply.

    How do I setup a contact form to send BCC emails?

    Thanks

    #328882

    Hi seanchk!

    The code has changed a bit and it’s found on line 708 instead.

    Open to this file /enfold/framework/php/class-form-generator.php and go to the line 708:

    Add this line:
    $header .= ‘Bcc: (Email address hidden if logged out) ‘. “\r\n”;

    Best regards,
    Arvish

    #617985

    I forgot to add this to my child theme so the changes have been overwritten by an update.

    When I look at line 708 of file /enfold/framework/php/class-form-generator.php it is blank…. so I’m not sure if I’m putting this code in the right place now.

    Can you confirm these instructions still stand and line 708 is where I should place the code?

    $header .= ‘Bcc: (Email address hidden if logged out) ‘. “\r\n”;

    Thanks

    Sean

    #618014

    Hi!

    Yes, that is the line you have re replace
    Please let us know if it works or if we can do anything else for you

    Regards,
    Basilis

    #621444

    Hi Basilis,

    I added the line

    $header .= ‘Bcc: ( (Email address hidden if logged out) ) ‘. “\r\n”;

    at line 708

    But I don’t get bcc’d on the contact form emails

    Actually I put the file /enfold/framework/php/class-form-generator.php into /enfold-child/framework/php/class-form-generator.php so maybe that is the problem?

    Thanks for your help

    Sean

    #623082

    Hi!

    exactly, that’s not a template file so you cannot move it to the child theme.

    Cheers!
    Andy

    #626211

    Hi Andy,

    I tried making the change to the correct file and got this error

    Parse error: syntax error, unexpected ‘$header’ (T_VARIABLE), expecting function (T_FUNCTION) in /home/skrsedphu/public_html/wp-content/themes/enfold/framework/php/class-form-generator.php on line 708

    Thanks

    #627179

    Hi,

    I think you can actually do this using a hook, discard the changes you’ve done so far and try adding this to your child theme functions.php:

    add_filter('avf_form_mail_header', 'add_bcc_to_form', 10, 3);
    function add_bcc_to_form($header, $new_post, $form_params){
    	$header .= 'Bcc:  (Email address hidden if logged out) '."\r\n";
    	return $header;
    }
    
    

    Best regards,
    Josue

    #627586

    Thank you Josue!

    That works great.

    Sean

    #627752

    You are welcome Sean, glad to help :)

    Regards,
    Josue

    #918570

    Hello
    I entered the code in file functions.php and it works!
    But the bcc email address receives mail twice, probably because in the contact form I set 2 email to send it to.
    Can it be solved?
    Thank you!

    #919123

    Hi,

    If the 2 emails are different then it shouldn’t send twice, but if it’s a linked email then that’s possible. Can you post the code you added, just replace the email address used (if an email address is used twice please use the same dummy email).

    Best regards,
    Nikko

    #1071227

    I try to use this code

    
    add_filter('avf_form_mail_header', 'add_bcc_to_form', 10, 3);
    function add_bcc_to_form($header, $new_post, $form_params){
    	$header .= 'Bcc:  (Email address hidden if logged out) '."\r\n";
    	return $header;
    }
    

    but with WPML do not work with all form language

    #1072079

    Hi,

    What do you want to change in this function, based on WPML?

    Best regards,
    Basilis

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.