Skip to main content

Creating Form-to-Email

How to create a form that will email someone using the CoE email gateway script.

1. Create your HTML form using standard HTML. Set the form tag's action attribute to "/mail_gate/formmail.php". Use "multipart/form-data" if you want to upload a file as well.

Example:

 <form action="/mail_gate/formmail.php" id="form_name" name="form_name" method="post">

 

2. Ensure your HTML form has the following fields defined. These are fields you expect the user to fill in: 

email
the user's email address
realname
the real name of the user

Example:

 

<input type="text" id="email" placeholder="Use full email address">
<input type="text" id="realname" placeholder="Use full name">
Email type might work instead of text:
<input type="email" id="email" placeholder="Use full email address">

 

 

3. Add some hidden fields to your form to tell FormMail what to do with the form results.

recipients
person/email to send the data to
subject
subject of the email
required
required fields from the form, along with a "friendly name" for each field that will be used if there is an error
good_url
page to redirect on successful submission of the form

Example:

<input type="hidden" name="recipients" value="someone@uw.edu,someone_else@uw.edu" />
<input type="hidden" name="subject" value="Form submission" />
<input type="hidden" name="required" value="email:Your email address,realname:Your name,other_field:Please fill in this field" />
<input type="hidden" name="good_url" value="/thank_you.html" />

 

4. Close the form with a submit button and <form> tag.

Notes:

1. The script will only allow recipients with an email address @uw.edu, @washington.edu, @engr.washington.edu or @aa.washington.edu.
2. Use 'enctype="multipart/form-data"' in the <form> tag if you want to upload a file.
3. The server will only allow an email with a maximum total size of 20MB. That means you should specify a maximum file upload size of about 19MB.<

More documentation here:
https://www.tectite.com/formmaildoc.php

Examples used on our website(s):
https://www.aa.washington.edu/alumni/contactUpdate
https://www.hcde.washington.edu/internships/internship-form