Send E-mail from a Web Form

Using the med-info web fileserver
Home

How to:

Neat tricks:

More:

 

In order to send e-mail from a web form, you must first know how to create a web form. This is standard HTML (here's one forms tutorial ; let us know if you've found a better one), and most modern web editors also include tools for creating forms. Alternatively, you could just cut and paste the source from the basic sample feedback form included below.

You need to know three things to send e-mail from web forms on www.med.umich.edu:

1. Your FORM tag needs to refer to our form-processing script, FormMail. Use this HTML code:

<form method=POST action="http://www17.med.umich.edu/scripts/FormMail.pl">

If your form is secure (it resides in the /secure folder on MED-INFO and has an address beginning with https://) because it is used to transmit patient or confidential information, this code should be specified as:
<form method=POST action="https://www17.med.umich.edu/scripts/FormMail.pl">

2. The e-mail address of the recipient (you of course need to use any valid e-mail address in place of somebody@umich.edu):

<input type=hidden name="recipient" value="somebody@umich.edu">

This does not have to be a hidden form field; you could also allow the person who is filling in the form choose the recipient's address. However, note that messages can only be delivered to valid addresses that end with umich.edu (this includes @umich.edu and @med.umich.edu).

If your form is secure (it resides in the /secure folder on MED-INFO and has an address beginning with https://), it should only be sent to Groupwise addresses, using the following format:

uniqname@smail-int.med.umich.edu (a group or resource name may also be used instead of an individual uniqname)

3. Messages generated by online forms must have a properly formatted return address. The field called "email" is used to specify this. This field could be hidden, if the form is always submitted anonymously:

<input type=hidden name="email" value="anonymous@umich.edu">

FormMail will automatically add this return address to forms submitted with no e-mail address specified, so that the message can be delivered:

no-email-address-was-provided@med.umich.edu

You may also give users the option of entering their own e-mail address in a text field, as in the sample form below.
Your Email Address : <input type=text name="email" size=30>

Whatever method you choose, the e-mail address must be formatted properly (something followed by an "@" followed by a valid domain name), or the message will not be delivered. If you do choose to let users type in their own address, be sure to make it a required field, so that an error message will be generated if they attempt to send it without entering it:
<input type=hidden name="required" value="email">

There are other optional hidden configuration fields you can also use to change how FormMail works. For complete instuctions, see the FormMail documentation. (This links takes you to another website, so you'll need to use your "back" button to return here.)

Here's a sample feedback form that you can copy and modify to suit your needs. The HTML source for the form appears below it.

Sample Comment/Suggestion Form

Subject :            
Your Name :          
Your Email Address : 
Your Phone :         
Your Title :         
Comments :           

 

 

<form method=POST action="http://www17.med.umich.edu/scripts/FormMail.pl">
<input type=hidden name="recipient" value="nobody@umich.edu">
<input type=hidden name="required" value="email">
<PRE>
Subject : <input type="text" name="subject">
Your Name : <input type=text name="realname" size=30>
Your Email Address : <input type=text name="email" size=30 value="Please enter your CORRECT email address">
Your Phone : <input type=text name="phone" size=30>
Your Title :
<select name="title">
<option>
<option>Doctor
<option>Nurse
<option>Clerk
<option>Other </select>
Comments :
<textarea name="comments" cols=60 rows=4 wrap="virtual"></textarea>
</PRE>
<input type=submit value="Send this" name="submit">
<input type=reset value="Start Over" name="reset">

<!-- The following are examples of the optional settings that you can use in your forms. (They
are not being used in this form.) See
http://worldwidemart.com/scripts/readme/formmail.shtml#form_config for more information:

<input type=hidden name="required" value="email,realname"> <input type=hidden name="env_report" value="REMOTE_HOST,REMOTE_ADDR,REMOTE_USER,HTTP_USER_AGENT">
<input type=hidden name="print_config" value="realname,email">
<input type=hidden name="sort" value="order:phone,comments">
<input type=hidden name="title" value="Thank You for Your Suggestion">
<input type=hidden name="bgcolor" value="#FFFFFF">
<input type=hidden name="text_color" value="#000000">
<input type=hidden name="link_color" value="#FF0000">
<input type=hidden name="vlink_color" value="#0000FF">
<input type=hidden name="return_link_url" value="http://www.med.umich.edu/">
<input type=hidden name="return_link_title" value="To the Medical Center homepage"> -->

</form>

WWW@UMHS | Using the MCIT Web File Server

 


Document: http://www.med.umich.edu /umhswww/howto-form2email.htm
Last updated: Thursday, 03-Oct-2002 17:06:36 EDT
Comments to: ASK-UMHS on Groupwise. If you do not use the UMHS Groupwise system, add @med.umich.edu to that to form a complete Internet address.