-
AuthorPosts
-
October 2, 2014 at 11:59 am #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
October 2, 2014 at 1:01 pm #328882Hi 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,
ArvishApril 20, 2016 at 5:45 am #617985I 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
April 20, 2016 at 7:07 am #618014Hi!
Yes, that is the line you have re replace
Please let us know if it works or if we can do anything else for youRegards,
BasilisApril 25, 2016 at 4:21 pm #621444Hi 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
April 27, 2016 at 2:26 pm #623082Hi!
exactly, that’s not a template file so you cannot move it to the child theme.
Cheers!
AndyMay 3, 2016 at 6:24 am #626211Hi 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
May 4, 2016 at 1:13 pm #627179Hi,
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,
JosueMay 5, 2016 at 4:35 am #627586Thank you Josue!
That works great.
Sean
May 5, 2016 at 12:46 pm #627752You are welcome Sean, glad to help :)
Regards,
JosueFebruary 27, 2018 at 6:12 pm #918570Hello
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!February 28, 2018 at 3:58 pm #919123Hi,
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,
NikkoFebruary 25, 2019 at 11:26 am #1071227I 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
February 27, 2019 at 12:35 am #1072079 -
AuthorPosts
- You must be logged in to reply to this topic.