-
-
Save mattlevine/041ad1dd0e267a77ff740dd901c2d495 to your computer and use it in GitHub Desktop.
Mura CMS : How to send an email to the person who submitted the form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- Drop this in your Site or Theme eventHandler.cfc ---> | |
<cffunction name="onAfterFormSubmitSave"> | |
<cfargument name="$"> | |
<cfset var msg = '' /> | |
<cfset var formBean = $.event().getValue('formBean') /> | |
<cfset var formResultBean = $.event().getValue('formDataBean') /> | |
<cfset var formResultStruct = $.event().getValue('formDataBean').getValue('formResult') /> | |
<cfif formBean.getTitle() eq 'Your Desired Form Title'> | |
<cfsavecontent variable="msg"> | |
<!--- this assumes your form had a 'name' form field ---> | |
<cfoutput> | |
<p>Hello #formResultBean.getValue('name')#,</p> | |
<p>Thank you for submitting a form!</p> | |
<p>Cheers,<br> | |
The Mura Team</p> | |
</cfoutput> | |
</cfsavecontent> | |
<!--- assumes your form had a 'emailFrom' field that collected the 'from' email ---> | |
<cfset $.getBean('mailer').sendHTML( | |
html=msg | |
, sendto=formResultBean.getValue('emailFrom') | |
, from=formResultBean.getValue('emailFrom') | |
, subject='Your Subject' | |
, siteid=$.event('siteid') | |
, replyTo=formResultBean.getValue('emailFrom') | |
) /> | |
</cfif> | |
</cffunction> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment