Embedding MGI Tags

Example

Embedding an mgiFieldContent tag in the "from" parameter of an mgiSendMail tag to dynamically change the email's from address.

MGI Tags

  • mgiSendMail
  • mgiFieldContent

Steps

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


Step 1: Create a form and thank you page.

Following the instructions for processing forms to email, create an information request form and thank you page that contains the mgiSendMail tag.

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

Open the thank you page that contains the mgiSendMail tag in a text editing program that allows you to view and modify HTML.

Step 3: Insert the mgiFieldContent tag in the beginning mgiSendMail tag.

In the mgiSendMail tag, remove the quotation marks and email address from the "from" parameter. Enter an mgiFieldContent tag, name parameter, and defaultValue parameter as the embedded value of the "from" parameter in mgiSendMail. Enter the name of the email form field, "Email", in the name parameter of the mgiFieldContent tag. Enter a default email address in the defaultValue parameter of the mgiFieldContent tag (in case a visitor does not provide their own email address). Enclose the mgiFieldContent tag and its parameters with braces {}.
<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 your home page to the web server running MGI.

Upload the form page and thank you page to the web server with an FTP program.

Step 6: Complete and submit the form.

Access the information request form with a web browser. Complete the form including a valid email address. Submit the form. The email that is sent contains your email address in the from header information.


[Return to the Embedding MGI Tags Menu]


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