Processing Forms to Email

Example

Sending a formatted email from an information request form.

MGI Tags

  • mgiSendMail
  • mgiFieldContent

Steps

  1. Create the information request form page.
  2. Name the form fields.
  3. Enter a form action and method.
  4. Save the form.
  5. Create a thank you page.
  6. Save the thank you page and open it in a text editor.
  7. Insert the mgiSendMail tag.
  8. Format the email with text and mgiFieldContent tags.
  9. Save the thank you page.
  10. FTP the form and thank you page to the web server running MGI.
  11. Complete and submit the form.


Step 1: Create the information request form page.

Enter HTML form fields on a page using a graphic editor or text editor. Enter a label and default size text field for Name, Company, Address, City, State, Zip, Country, Phone Number, and Email Address. Also enter instructions and a Comment text box with 7 rows and 50 columns. Finally, enter a submit button named "Submit Information Request". The following is an example information request form:
Name  
Company  
Address  
City  
State  
Zip  
Country  
Phone Number  
Email Address  

Please describe any specific comments or questions in the box below.

Step 2: Name the form fields.

Name each text field and the text box with a unique name. For example, name the first text field "Name", the second text field "Company", etc. You may use capitalization and spaces in the form field name.

Step 3: Enter a form action and method.

A form action sends form information to a separate "thank you" page for processing. Enter the name of the thank you page (thankyou.html) in the action parameter of the <FORM> tag. Enter "post" in the method parameter of the <FORM> tag. For example,
<FORM ACTION="thankyou.html" METHOD="post">
...text fields, text box, and submit button appear here...
</FORM>

Caution: A beginning and ending <FORM> tag must enclose all form elements including text fields, text boxes and buttons.

Step 4: Save the form.

Save the information request form you have created.

Step 5: Create a thank you page.

Create a new page and enter the sentence "Thank you for your request. A representative will contact you shortly!".

Step 6: Save the thank you page and open it in a text editor.

Save the thank you page and name it "thankyou.html". Before you proceed to the next step, open the thankyou.html page in a text editor or in the HTML view of a graphic editor).

Caution: The thank you page name must match the action parameter of the <FORM> tag that you entered on the information request form page.

Step 7: Insert the mgiSendMail tag.

Insert your cursor before the ending </BODY> tag and enter the beginning and ending mgiSendMail tags. The beginning mgiSendMail tag has 4 required parameters (to, from, subject, and mailserver). In the "to" parameter enter the email address where form submissions will be sent. In the "from" parameter, enter the email address that will appear in the "from" line of the email. In the "subject" parameter, enter the subject of the email. In the "mailserver" parameter, enter the address of the outgoing SMTP server that will process the email. For example,
<mgiSendMail to="info@domain.com" from="webmaster@domain.com" 
subject="Info Request" mailserver="mail.domain.com">
...the content of the email appears here...
</mgiSendMail>

Tip: The mgiSendMail tag can be entered anywhere on the thankyou.html page because it will be removed when it is processed by MGI and will not be visible to web site visitors.

Step 8: Format the email with text and mgiFieldContent tags.

Enter text labels and mgiFieldContent tags in the body of the mgiSendMail tag. Each mgiFieldContent tag displays the information from a form field. In the name parameter of mgiFieldContent, enter the name of the form field to display. The following is an mgiSendMail tag, text labels, and mgiFieldContent tags for the information request thank you page:
<mgiSendMail to="info@domain.com" from="webmaster@domain.com" 
subject="Info Request" mailserver="mail.domain.com">
Information Request
*******************

   Name: <mgiFieldContent name="name">
Company: <mgiFieldContent name="company">
Address: <mgiFieldContent name="address">
   City: <mgiFieldContent name="city">
  State: <mgiFieldContent name="state">
    Zip: <mgiFieldContent name="zip">
Country: <mgiFieldContent name="country">
  Phone: <mgiFieldContent name="phone">
  Email: <mgiFieldContent name="email">

Comments:
<mgiFieldContent name="comments">
</mgiSendMail>

Step 9: Save the thank you page.

Save the changes you have made to the thank you page.

Step 10: FTP the form and thank you page to the web server running MGI.

Upload your information request form and thank you page from your local computer to the web server using an FTP program.

Step 11: Complete and submit the form.

Access the information request form page in a browser, complete the form and submit the form. After you submit the form, the thank you page with the message "Thank you for your request. A representative will contact you shortly!" is displayed. Simultaneously, an email is sent with the following message (for example):
Information Request
*******************

    Name: Allan Para
 Company: Para, Inc.
 Address: 1234 Main Ave.
    City: Denver
   State: CO
     Zip: 33489
 Country: US
   Phone: 848-293-4712
   Email: allan@parainc.com

Comments:
I am interested in your product, but does it come in different sizes?


[Return to the Processing Forms to Email Menu]


[User Guide Main Menu] [Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]