MailThis.to BETA

Turn form submissions into emails

No configuration required. Just build a form & submit POST data to our server, and the data arrives in your mailbox seconds later. Even attachments!

GET STARTED

  Full Documentation

Getting Started


1.  Create an Email Alias (optional)

Enter your email address and choose a Username (alias) to embed in your forms.

NOTE: Registration is recommended, but not required. However, registering allows you to mask your email behind an alias, greatly reducing spam.

2.  Create an HTML form

Create an HTML form which posts data to the Mailthis.to API. An example contact form is provided below:



<form action="http://mailthis.to/" method="post">
  <div>
    <label for="email">Email Address:
    <input type="email" name="email" id="name" placeholder="[email protected]" />
  </div>
  
  <br>
  <div>
    <label for="message">Message:</label>
    <br>
    <textarea cols="40" rows="8" name="message"></textarea>
  </div>
  
  <div>
    <input type="submit" value="Contact Us" />
  </div>
</form>



3.  Using advanced fields (optional)

Specify a custom email subject. If omitted, the default subject will be used.

<input type="hidden" name="_subject" value="My awesome subject">

Specify a custom reply to email address for the email.

<input type="hidden" name="_replyto" value="[email protected]">

Instead of specifying a static custom "reply to" address, you can also choose to use an email address entered by the user of the form. In order to do this, give your custom "replyto_" field a value of "%" followed by the name of the field. Let's assume you have a field named "email" which value you'd like to use for your custom "reply to" field, then you'd give you "reply to" field a value of "%email".

<input type="hidden" name="_replyto" value="%email">

Specify one or more CC recipients for the email.

<input type="hidden" name="cc[]" value="[email protected]">
<input type="hidden" name="cc[]" value="[email protected]">

Use the above syntax to specify one or more CC recipients. Please note the name of this field is "cc[]". This allows you to specify any number of entries, rather then just one.

Specify one or more BCC recipients for the email.

<input type="hidden" name="bcc[]" value="[email protected]">
<input type="hidden" name="bcc[]" value="[email protected]">

Use the above syntax to specify one or more BCC recipients. Please note the name of this field is "bcc[]". This allows you to specify any number of entries, rather then just one.

Specify a URL to redirect the user to after successfully submitting the form.

<input type="hidden" name="_after" value="http://google.com">

This is a special field which acts as a form of SPAM protection. This hidden field will not be shown to regular visitors, but most SPAM bots will automatically enter a value into this field. If Mailthis.to detects a value, the data is considered SPAM and won't be processed (no email will get sent).

<input type="text" name="_honey" value="" style="display:none">

Mailthis.to handles form files with a breeze. Simply add the following element to your form and API will attach the file the email it sends out:

<input type="file" name="file">

Set a custom confirmation message shown to the user after successfully submitting the form:

<input type="hidden" name="_confirmation" value="<b>Thank you!</b> We have received your message and will get back to you asap.">

4.  Using validation fields (optional)

Mailthis.to lets you set validation rules on the submitted data. The syntax is simple, just add a hidden input field to your form, and set the name attribute to name="_valid[field_name]" where you woud replace "field_name" with the name of the field for which you are defining a rule. If you were to have a field named "email", then you name your validation field name="_valid[email]".

The value attribute of your validation field should contain one or more validation rules. When specifying multiple rules for a single field, the rules should be separated by a "|" as such name="rule_one|rule_two|rule_three".

Below is a list of all validation rules:

Rule Description Example
required Returns FALSE if the form element is empty.
min_length Returns FALSE if the form element is shorter then the parameter value. min_length[6]
max_length Returns FALSE if the form element is longer then the parameter value. max_length[12]
exact_length Returns FALSE if the form element is not exactly the parameter value. exact_length[8]
greater_than Returns FALSE if the form element is less than the parameter value or not numeric. greater_than[8]
less_than Returns FALSE if the form element is greater than the parameter value or not numeric. less_than[8]
alpha Returns FALSE if the form element contains anything other than alphabetical characters.
alpha_numeric Returns FALSE if the form element contains anything other than alpha-numeric characters.
alpha_dash Returns FALSE if the form element contains anything other than alpha-numeric characters, underscores or dashes.
numeric Returns FALSE if the form element contains anything other than numeric characters.
integer Returns FALSE if the form element contains anything other than an integer.
is_natural Returns FALSE if the form element contains anything other than a natural number: 0, 1, 2, 3, etc.
is_natural_no_zero Returns FALSE if the form element contains anything other than a natural number, but not zero: 1, 2, 3, etc.
valid_email Returns FALSE if the form element does not contain a valid email address.
valid_emails Returns FALSE if any value provided in a comma separated list is not a valid email.
valid_ip Returns FALSE if the supplied IP is not valid. Accepts an optional parameter of "IPv4" or "IPv6" to specify an IP format.

Contact Us

Questions? Comments? Feedback? Use the form below to "let us have it"!


Copyright © 2015 Mailthis.to.  All Rights Reserved.