Mailform Docs

All the ins and outs of the Mailform extension, so you can customize it to your liking.

Error Codes

You can display error codes and/or error messages when a form submission fails. Simply add {errorcode} to the div to display the error code and/or {errormsg} to display the message. The list below contains all error codes that are in use.

E1200 Request did not pass simple CAPTCHA.
E1201 AJAX call failed
E1202 Dependency for file attachments not available on server.
E1203 An unknown error occured.
E1204 POST data did not contain a g-recaptcha-response.
E1205 Dependency for reCAPTCHA not available on server.
E1206 Did not receive valid JSON from reCAPTCHA verification service or service not available.
E1207 Request did not pass reCAPTCHA (followed by error code)
E1208 Invalid reCAPTCHA token (followed by error code)
E1209 Request did not pass reCAPTCHA score.
E1210 Error uploading file (followed by file name)
E1211 Error uploading file (mime type is not allowed)
E1212 Error uploading file (followed by file name and error code)
E1213 Mail could not be sent (followed by error info)
E1214 Autorespond mail could not be sent (followed by error info)
E1215 Exception in sending email (followed by error info)
E1216 Not all required fields are present (either "subject" or "email")
E1217 Invalid email address.
E1218 Required file is missing

Custom Error Messages

As these messages are not always user friendly (or too technical), you can overwrite them with your own by simply creating a JavaScript array in the pages containing a form (or put it in Global HTML). If the error code isn't present in the array you defined, the default error message will be displayed instead.

var wsMfErrors = {
    "E1211""Mime Type is not allowed",
    "E1217""The email address you provided is not valid"
};

Mini Templates

These come in handy if you have more than one form in your website. With mini templates, you can provide additional text for either the normal mail template or the auto response template.

The mini templates are named mtxt and rtxt. The "mtxt" variable only ends up in the normal mail, where the "rtxt" only ends up in the response email. If you make use mini templates, you have to reference them in the mail or response templates under Site Settings. Use {mtxt} in the mail template, {rtxt} in the response template.

You can also reference other form variables in mini templates. For example, if your "mtxt" is this: "Hi {name}, thanks for your message. We'll be in touch", the {name} will be replaced with the name that's submitted with the form.

Build Your Own Form

It's quite easy to use our extension with any of your forms. Just follow the steps below and you're good to go.

  • Add the class and plugin
    Add the class AND plugin "witsec-mailform" to the <section>.
  • Mandatory input fields
    Make sure a field named "email" exists anywhere in the form. Without this, a submitted form will be rejected.
  • Email subject
    Make sure a field named "subject" exists anywhere in the form. This could be a hidden input, a text input, a select box, etc. As long as the field is present. This field will be used as the subject of the email.
  • Success and Error Messages
    To let the user know if sending the form was successful or not, add both a "success" and an "error" message anywhere in the form. Make sure this element contains the class "alert-success" or "alert-danger".
  • Autoresponder
    If you want an autoresponder email, make sure there's a field named "autorespond" with a value of "1". If the field is not present or the value is anything else, the autoresponder won't work.
  • Alternative recipient
    If you wish to use a different recipient than the default one, make sure there's a field named "recipient" anywhere in the form. This can either be a hidden field, a text input, a select box, etc. The value of this field has to correspond to an entry in the Address Book.
  • Redirect after successful submission
    If you wish to redirect the visitor after successfully sending a form, simply add a field named "redirectURL" anywhere in the form. The value of this field should be the URL to where the visitor will be redirected. This could be a relative path (e.g. thanks.html) or an absolute path (e.g. https://yourdomain.com/thanks.html).
  • Remove mbr-form attribute
    If you're using a form built with the Mobirise Form Builder (or any other form using Formoid), remove the attribute "mbr-form" from the <div> containing the <form>.

Simplified Example

The HTML code below is a simplified example of what you need to get the Mailform working, in case you want to create your own from scratch.

<section class="witsec-mailform mbr-section" plugins="witsec-mailform">

    <mbr-parameters>
    <!-- Any parameters you may want go here -->
    </mbr-parameters>

    <form class="mbr-form">
        <input type="hidden" name="subject" value="Subject goes here">

        <div hidden="hidden" class="alert alert-success mbr-alert-success">Thanks for filling out the form!</div>
        <div hidden="hidden" class="alert alert-danger mbr-alert-danger">An error occured. Please try again.</div>

        Name:<br>
        <input type="text" name="name" required="required"><br><br>

        Email:<br>
        <input type="email" name="email" required="required"><br><br>

        Message:<br>
        <textarea name="message" mbr-theme-style="display-7" required="required" class="form-control"></textarea><br><br>

        <button type="submit" class="btn btn-primary btn-form">SEND FORM</button>
    </form>

</section>

All Mailform Variables

NAMEDEFINITION
autorespondDetermines if an auto response email should be sent. Value should be set to "1".
emailThe email address of the person submitting the form. This field must always be present.
mtxtMini template for the normal email. Can contain references to other form variables, like {name}.
nameDefault name of the "name" field that can be used as the name of the sender. This can be changed under Site Settings.
recipientRecipient ID that corresponds with a an ID from the Address Book (under Site Settings).
redirectURLURL to which the visitor will be redirected after a successful form submission.
rtxtMini template for the response email. Can contain references to other form variables, like {name}.
subjectThe subject of the email. This will also be used for the auto response email, unless overridden in the Site Settings.

Get in touch

This form uses Google's reCAPTCHA. By continuing you agree to the Privacy and Terms.