How to add a "send copy to myself" option to Contact Form 7
Add "Send a copy of this email to your inbox" in Contact Form 7
/* Compatible only with Contact Form 7.39 beta and above */
function wpcf7_send_mail_to_self( $additional_mail, $cf )
{
$submission = WPCF7_Submission::get_instance();
if ( $submission )
{
$posted_data = $submission->get_posted_data();
$debug = print_r($posted_data, true);
if ( empty($posted_data['send_c'][0]) )
{ // clear mail2 options
$additional_mail = array();
}
}
return $additional_mail;
}
add_filter( 'wpcf7_additional_mail', 'wpcf7_send_mail_to_self', 10, 2 );
Recent Comments