By default the system formats the output email in a certain way, be it the standard output email or the autoresponse email. This format is simple, clean and basic. For plain text emails, the output shows the form field names together with the submitted data. For HTML formatted emails, the same information is shown in a table, with the field names in bold. There is a limited amount of customization you can do with these.
If you have a need for formatting the output email in a particular way, then you can use a template to make the body of the email, which means it can appear exactly as you want it to, be it plain text or HTML. You can write the template in straight plain text or you can write it in HTML, just like you were writing a web page. You can use a template for the standard email output and also for the autoresponse email that gets sent to your visitor (if enabled).
To use a template, you need to write it first then enable the option for it in the form configuration in the User Panel. The option to enable is "Email Template". You should enter your template code in the "Email Template Content" textarea of the configuration.
It is probably best to write your template in a file, then paste the contents of the file into the "Email Template Content" textarea in the form configuration. The instructions below, assume you will be writing it in a file first.
Open a new blank file in a text editor (such as Notepad). Write the text in the file just as you would like the email to appear. To show submitted values from the form, use this placeholder:
form_field with the name of the form field you want to get the data from. Here's an example. Suppose you have these inputs on your form:
<input type="text" name="name"> <input type="text" name="email"> <input type="text" name="state">
You could put this text in your email template file:
Message from ff<name>. The visitor's email address is: ff<email> The visitor is from ff<state>.
Suppose the visitor enters his name as Bob, and his email address is email@example.com and he is from Texas. This will produce the following text in the email you get:
Message from Bob. The visitor's email address is: firstname.lastname@example.org The visitor is from Texas.
With a plain text template, write the template exactly as you want it to appear in the email, like above. Line breaks are automatically converted, so you can make new lines or paragraphs and these will be replicated in the email you get. So effectively you are just writing the email as you want to get it but using the
ff<form_field> placeholders where appropriate.
When you have written the template file, paste the contents of the file into the "Email Template Content" textarea in the file configuration edit page.
Important: write the form field in the placeholder EXACTLY as it appears in your form. So if you have an input on your form like this:
<input type="text" name="First_NAME">
You would use
ff<First_NAME> in your template.
As before, and using the example form values above, open a new blank file in a text editor or HTML editor. Write the HTML code in the file just as you were writing a webpage. To show submitted values from the form, use the same placeholder above. Here's an example of an HTML email template:
<html> <head> <title>Message from ff<name></title> </head> <body> <p>A message from <strong>ff<name></strong> whose email address is ff<email> and who is from ff<state>.</p> </body> </html>
For HTML emails you should use very simple and often deprecated HTML. This is due to notoriously poor support for HTML in email readers. Equally, support for CSS isn't great. Experiment with your own email program.
If using an HTML template, you need to enable the "HTML Format" option in the form configuration.
The above examples use values from your form. There are some values generated by the system that you might want to show in your templates. Some of them need to be enabled in the form configuration options first. The system-generated values are: Sender's IP Address, Date and Time submitted, Message ID and Attachment Filenames. To use these values in your template (subject to them being enabled where appropriate) use this code:
ff<Sender's IP address> ff<Date submitted> ff<message_id> ff<resume_attachment>
Note: To display attachment file names like in the above example you need to use the
name value of your file input. So if your upload field looks like this
<input type="file" name="resume_attachment"> you would use the following in your html template
ff<resume_attachment>. The rest of the above example can be copied exactly as shown.
A template only makes the body of the email. Enter the subject for the email in the "Subject" option in the form configuration.
You can configure the form to use a template for the autoresponse email too. This is done in the same way as configuring it to use a template for the standard output email. You need to enable the "Autoresponse Email Template" option in the form configuration, and enter the autoresponse template content in the "Autoresponse Email Template Content" textarea in the form configuration.