Form-Mail Helper
The Form-Mail Helper provides functions that assist in working with Form-Mails.
Loading this Helper
This helper is loaded using the following code:
rigLoadHelper "formmail"
The following handlers are available:
rigFormMail(filePath, substitutionData, prefix, suffix)
Fetches the form-mail template, assigns an array containing words for substitution and assigns prefix/suffix characters used in the mail template to surround the words to be substituted.
Parameters
- filePath: is the path to your mail template relative to root, remember: Root is where your index.lc file is located
- substitutionData: is an associative array where the keys are the placeholders used in your template and the values are the words used for replacement
- prefix: (optional) default values is: "<#", you have to assign this value if you use different characters for prefix in your template
- suffix: (optional) default value is ">", you have to assign this value if you use different characters for suffix in your template
This function returns FALSE if the template was not found or TRUE otherwise.
rigFormMailReplace()
Substitutes the placeholders in your template with the values of an array.
This function returns the customized text of your form-mail.
Let's say your template looks like this:
Dear <#firstName> <#lastName>,
thanks for your message regarding <#subject>.
We will see to your case quickest possible.
Best regards
Rev Igniter
Company
Then your code would look like this:
put "John" into tFormMailArray["firstName"]
put "Doe" into tFormMailArray["lastName"]
put "revIgniter" into tFormMailArray["subject"]
put "assets/modules/contact/emailText/contactConfirmationMail.txt" into tMailText
get rigFormMail(tMailText, tFormMailArray)
put rigFormMailReplace() into tResponse