[Formit] How to send a confirmation to the a selected e-mail

Hi
I just create a form with a lot of fields.
One part concerns the child data with the e-mail of the child.

The second part, concerns the parent (mother, father) with the e-mail of the parent.

While the parent send the subscription, I want to send the e-mail to the school for the registration, The school get the data of the student (child) and the data of the child’s parent.

A confirmation need to be send the parent’s email.
Here is my formit (which works)

[[!FormIt?
	&hooks=`email,math`
	&mathMinRange=`10`
	&mathMaxRange=`20`
	&mathField=`math`
	&emailTpl=`f_cours_individuels_emailTpl`
	&clearFieldsOnSuccess=`1`
	&emailSubject=`Insciption aux cours individuels`
	&validationErrorMessage=`Une erreur s'est produite. Vérifiez la saisie du formulaire.`
	&successMessage=`Votre message a bien été envoyé!`
	&emailTo=`secretariat@school.ch`
	&emailFrom=`[[++emailsender]]`
	&validate=`nospam:blank,
		f_e_sex:required,
		f_e_name:required,
		f_e_firstname:required,
		f_e_date-naissance:required:isDate=^%d.%m.%Y,
		f_e_rue:required,
		f_e_cp-localite:required,
		f_e_telephone:isNumber:required:minLength=10,
		f_e_email:email:required,
		f_e_etudes-m-anterieures:required,
		f_p_parent:required,
		f_p_name:required,
		f_p_firstname:required,
		f_p_date-naissance:required,
		f_p_rue:required,
		f_p_cp-localite:required,
		f_p_telephone:isNumber:required:minLength=10,
		f_p_email:email:required,
		f_p_autre-enfant:required,
		f_p_instrument:required,
		f_p_duree-cours:required,
		f_p_facture-payable:required,
		math:isNumber:required`
]]

secretariat@school.ch receives the registration email, but the sender e-mail is the e-mail saved in MODx system. (hello@school.ch). Additionally no confirmation e-mail is sent to the personn who filled the form.

First question:
I do not understand this &emailFrom=[[++emailsender]]
I see not difference between before and after I added it.

I would like to make sure that the school and the parent (or parent and child) receive the registration e-mail. The child email field name is f_e_email and the parent email field name is
f_p_email.

Is possible to add f_p_email to &mailto: or &emailFrom? or how can I send a confirmation to f_p_email, with may a small diferrent text as “Thanks for your registration. Here are the detail…”

Cheers

If the property &emailFrom is not set (and there is no field “email” in the form), then the code uses the system setting “emailsender”. So there is no difference (if the form has no “email” field).


Take a look at the FormItAutoResponder hook.

The property “emailTo” allows a comma-separated list of emails addresses.
You could set it in a custom hook, before the “email” hook runs.
There exist also the properties “emailCC” and “emailBCC” that you could use.


If nothing else works for you, you can always create a custom hook snippet that sends an email.

Hello,
Thanks for your reply. That works fine and more easier to apply than I excepted.
I could setup FormItAztoResponder as the following

[[!FormIt?
	&hooks=`email,math,FormItAutoResponder`
	&mathMinRange=`10`
	&mathMaxRange=`20`
	&mathField=`math`
	&emailTpl=`f_parcours_decouverte_emailTpl`
	&clearFieldsOnSuccess=`1`
	&emailSubject=`Insciption au parcours découverte`
	&validationErrorMessage=`Une erreur s'est produite. Vérifiez la saisie du formulaire.`
	&successMessage=`Votre message a bien été envoyé!`
	&emailFrom=`[[+f_p_email]]`
	&emailTo=`secretariat@school.ch`
	&fiarToField=`f_p_email`
	&fiarReplyTo=`[[++emailsender]]`
	&fiarSubject=`Confirmation de votre insciption au parcours découverte`
	&fiarFrom=`[[++emailsender]]`
	&fiarTpl=`f_parcours_decouverte_fiarTpl`
	&validate=`nospam:blank,
		f_e_sex:required,
		f_e_name:required,
		f_e_firstname:required,
		f_e_date-naissance:required:isDate=^%d.%m.%Y,
		f_p_parent:required,
		f_p_name:required,
		f_p_firstname:required,
		f_p_date-naissance:required,
		f_p_rue:required,
		f_p_cp-localite:required,
		f_p_telephone:isNumber:required:minLength=10,
		f_p_email:email:required,
		f_p_autre-enfant:required,
		f_p_instruments-coup-de-coeur:required,
		math:isNumber:required`
]]

Cheers