It’s easy to have contact or other forms on your website send email directly to Mailroom. All you have to do is setup your form HTML to submit directly to Mailroom and we’ll take care of the rest.
These instructions will tell you how to setup your form to submit to Mailroom. It assumes you have some knowledge of HTML. If you aren’t the one writing the HTML for your website, you can send this page to that person and they will be able to setup the form for you.
The Basics
The simplest way to send your form data to Mailroom is to change the action attribute in the form tag to point to “http://YOURACCOUNT/mailroom/deliver_form”. For if your account name was “bigbear.sproutit.com”, then the following form would collect comments from customers in a way that you can respond to:
<form action="http://bigbear.sproutit.com/mailroom/deliver_form" method="post"> <label>Your Name:</label> <input type="text" name="form_name" /><br /> <label>Email:</label> <input type="text" name="form_email" /></br /> <label>Comments:</label> <textarea name="comments"></textarea> <br /> <input type="submit" value="Send Comment" /> </form>
By default, Mailroom will use the input named “form_name” and “form_email” as the name and email address you will use to reply to. If you can’t change the names used for the form inputs, it is also possible to customize the key mailroom will look for.
In addition to the person’s name and email, Mailroom looks for a few other custom names also. Here is a complete list:
- form_email – The email of the sender. This is the bare minimum you should support if you want to be able to reply to people.
- form_name – The name of the sender.
- form_first_name and form_last_name – You can use this as an alternative to form_name if you would prefer to collect the names separately.
- form_subject – This will become the subject of the email you see in Mailroom.
- form_redirect – This is the URL users will be redirected to after Mailroom processes their request. If you don’t specify this, users will be sent back to the referring form URL.
- form_tag or form_tags – Optionally comma-separated values will be used to tag the email in Mailroom. This is especially useful as part of a select tag. (See below).
- form_owner – Set this to the username of the person you want to emails from this form to be assigned to. If you don’t include this option or if the username you set doesn’t exist, Mailroom will use the normal rules it follows for other email.
- form_attachment – You can use this to include attachments in your resulting email. See the section below for more information.
If you would like to specify one of these keys but without showing them to the user, you can use a hidden input element. (Except for the form_attachment key. See below.)
Any other inputs found in the form you submit will be placed into the body of the message delivered to Mailroom.
Customizing the Form Name
Sometimes you can’t change the names used for the input elements of a form. If this is the case, you can actually tell Mailroom to look for different keys by adding paramters to the URL.
Basically, for any name you would like to override, you should add NAME_key=YOUR_KEY to the parameter string. Here’s an example:
<form action="http://bigbear.sproutit.com/mailroom/deliver_form?email_key=user_email& name_key=user_name" method="post"> <label>Your Name:</label> <input type="text" name="user_name" /><br /> <label>Email:</label> <input type="text" name="user_email" /></br /> <label>Comments:</label> <textarea name="comments"></textarea> <br /> <input type="submit" value="Send Comment" /> </form>
In this example, Mailroom will use the input named “user_name” for the user’s name and “user_email” for the user’s email instead of the standard form_name and form_email. You can use a similar pattern for any of the special keys listed above.
Tagging Emails using Popup Menus (Selects)
Let’s say you have a form users can use to submit support requests or sales inquiries. You can use a pop-up menu to let them specify what type of request they have and then have Mailroom automatically tag their submission accordingly. For example:
<form action="http://bigbear.sproutit.com/mailroom/deliver_form" method="post">
<label>Your Name:</label> <input type="text" name="form_name" /><br />
<label>Email:</label> <input type="text" name="form_email" /></br />
<label>What kind of request is this?</label>
<select name="form_tag>
<option value="form:support">Support</option>
<option value="form:sales">Sales</option>
</select>
<label>Comments:</label>
<textarea name="comments"></textarea>
<br />
<input type="submit" value="Send Comment" />
</form>
The above example would tag form submissions as either “form:support” or “form:sales”. Note that you could do something similar for assigning emails as well. Naming the select tag “form_owner” and using usernames as the option values would cause incoming email to be assigned to different people based on the choice you make in this form.
Including Attachments
You can allow your customers to attach files to the forms they submit and those attachments will appear in Mailroom. To include file attachments, first add the attribute enctype=”multipart/form-data” to the form tag. Then add an input tag to your form with type=”file” and name=”form_attachment”. If you want to allow the user to attach more than one file, include multiple input tags, each with type “file” and names beginning with “form_attachment” such as “form_attachment_1”, “form_attachment_2”, etc.
The example below allows the user to attach up to two files to their form submission. File attachments are always optional:
<form action="http://bigbear.sproutit.com/mailroom/deliver_form" method="post" enctype="multipart/form-data"> <label>Your Name:</label> <input type="text" name="form_name" /><br /> <label>Email:</label> <input type="text" name="form_email" /></br /> <label>Comments:</label> <textarea name="comments"></textarea> <br /> <label>Attach a File:</label> <input type="file" name="form_attachment" /><br /> <label>Attach Another File if Needed:</label> <input type="file" name="form_attachment_1" /><br /> <input type="submit" value="Send Comment" /> </form>
