I am new to contact form 7. My task is to create a form that sends emails to recipients, who in turn are decided by the values selected by the user. i have the following form:
Please choose a mentorship category*
[checkbox* cb-ment label_first default:2 id:chk "1" "2" "3" " 4" "5" " 6"]
as the user clicks on the options (1,2,3,4,5,6) corresponding recipient email ids are to be assigned. ie, if user clicks on 1 his mail is to be sent to abc@gmail.com, if 2 then a.bc@gmail.com. if both 1 and 2 are chosen then mail is to be sent to both the email addresses
functions.php is:
$rmail="";
$subject="new mail";
$mailbody="Thankyou for your response!";
add_action( 'wpcf7_before_send_mail', 'process_contact_form_data' );
function process_contact_form_data( $contact_data ){
var_dump($contact_data->posted_data);
$cbment = $contact_data->posted_data["cb-ment"];
$rmail="";
}
function wpcf7_before_send_mail($rmail) {}
wp_mail($rmail,$subject,$mailbody)
how do i assign the mail addresses to their corresponding checkbox values?
Aucun commentaire:
Enregistrer un commentaire