Using a form to send an email


FlexForm can send a submitted form as an email. The FlexForm tag needs an action of 'email' for this. All other setting are done through the _email function.

An email is send using an email template. Such an email template can be any page in the Wiki where you define the details for the email.

When sending an email you need certain information:

At form level means this can be set within the Form. At template level means this is set within the template.
Name Type At form level At template level Mandetory
To email address yes yes yes
From email address no yes yes
Subject text yes yes yes
Content text no yes yes
CC email address no yes no
BCC email address no yes no
Reply to email address no yes no
Attachment Filepath no yes no
Header Wiki Page no yes no
Footer Wiki no yes no

All the elements needed to send an email can be set inside the email template. You can create multiple email templates. You simply tell FlexForm what email template to use in the form. The elements that can be set at form level will override any defined elements in the template.

All form elements that should be send with the email, must be defined in the email template. If you have a _field element of type text and a name of "address" and you want to send this with the email, you have to put the name of the field inside the template with a "$"-sign in front of it( in this case $address). See examples.

Form Parameters

to = recipients email address

template = Title name of Wiki pages containing the email template

subject = Subject of the email to be send

Template Parameters

_to = recipients email address

_from = senders email address

_subject = email subject

_cc = email address that receives a copy of the email

_bcc = email address that receives a copy of the email, but not visible to anyone else

_replyto = email address used when someone replies to the send email

_header = Title name of Wiki page with the email letterhead

_footer = Title name of Wiki page with the email footer

_html = Value can be yes or no, defaults to yes. Whether or not the email should be send as HTML (yes) or plain text (no)

If everything is defined in an email template, then _email would only need the template argument to send an email.


<_form action="email">
<_email template="FlexForm_mail_template"></_email>
<_input type="text" name="name" placeholder="Your name" />
<_input type="email" name="email" placeholder="Your email address" />
<_input type="text" name="city"  placeholder="City you live" />
<_input type="submit" value="submit your information" />

Wiki page with title "FlexForm_mail_template"

%_subject=Form submitted from website by $name%

<p>Dear <strong>$name</strong>,</p>
  Thank you for submitting the form on our website. We have received the following details:</p>
    <li>Name : $name</li>
    <li>Email : $email</li>
    <li>City : $city</li>
<p>We will contact you shortly</p>
<p>Best regards</p>