Embedding Information in the Email Header

Example

Dynamically entering a visitor's email address in the "from" header of an email.

MGI Tags

  • mgiSendMail
  • mgiFieldContent

Steps

  1. Create a form and thank you page to process the form.
  2. Open the thank you page in a text editor.
  3. Embed an mgiFieldContent tag in the mgiSendMail tag.
  4. Save the thank you page.
  5. FTP the thank you page to the web server running MGI.
  6. Complete and submit the form.


Step 1: Create a form and thank you page.

Create a form and thank you page to process the form information and send an email. See the Beginner "Processing Forms to Email" Tutorial for the steps to create a form and thank you page.

Step 2: Open the thank you page in a text editor.

Open the thank you page in a text editing program that allows you to modify the HTML of the page.

Step 3: Embed an mgiFieldContent tag in the mgiSendMail tag.

Remove the quotation marks and value from the "from" parameter in the mgiSendMail tag and embed an mgiFieldContent tag. To embed the mgiFieldContent tag, insert your cursor after the equal sign following the "from" parameter in mgiSendMail and enter an opening brace ({ - the squiggly ones), an mgiFieldContent tag, name parameter, defaultValue parameter, and closing brace (}). In the name parameter, enter the name of the form field that contains the visitor's email address. In the defaultValue parameter, enter a default email address that is used when the visitor does not enter an address.
<mgiSendMail to="info@domain.com" 
from={mgiFieldContent name="email" defaultValue="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 4: Save the thank you page.

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

Step 5: FTP the thank you page to the web server running MGI.

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

Step 6: Complete and submit the form.

Access the form page in a browser, complete the form and submit the form. The email address that you enter in the "Email" field appears in the "From" header of the email that is sent and the thank you page is displayed.


[Return to the Processing Forms to Email Menu]


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