The mgiSendMail Tag

Tag Behavior

The mgiSendMail tag emails a formatted text message to a specified address.

Tag Syntax

The mgiSendMail tag has a beginning tag with 4 required parameters and 2 optional parameters, a body, and an ending tag. The tag form is:

<mgiSendMail to="Email Address" from="Email Address" fromName="Name"
Subject="Email Subject" mailServer="Server Address" 
replyTo="Email Address" send="Yes/No" attachmentFileLocation="File Path" 
GMTOffset="Hours Offset">
MGI tags and formatted text

Required Parameters:

  • to="Email Address" where "Email Address" is the email address where emails are sent.
  • from="Email Address" where "Email Address" is the address that appears in the "from" line of the email header.
  • subject="Email Subject" where "Email Subject" is the subject of the email that is sent.
  • mailServer="Server Address" where "Server Address" is the address of the SMTP mail server that processes the email.

Optional Parameters:

  • fromName="Name" where "Name" is the real name of the person or organization whose email is listed in the "from" parameter. Warning: Some mail servers do not allow mail to be relayed if it contains a from name.
  • replyTo="Email Address" where "Email Address" is address that appears in the "Reply-To" line of the email header.
  • send="Yes/No" where "Yes" indicates that the email is sent and where "No" indicates that the email is not sent. The default is "Yes". This parameter can be used in conjunction with variables, conditional comparisons, and embedded tags to determine whether an email is sent.
  • attachmentFileLocation="File Path" where "File Path" is the relative path to an email attachment (at or below the current level of the file structure). Multiple files may be attached to an email by separating each file name with a comma. All attachments are Base64 encoded.
  • GMTOffset="Hours Offset" where "Hours Offset" is the four-digit number of hours the time of the email is offset from Greenwich Mean Time preceded by a positive (+) or negative (-) sign (e.g., GMTOffset="+0500"). The GMTOffset hours should be written as four-digits preceeded by a positive or negative sign. If the format is written incorrectly, an error page is displayed. When the GMTOffset parameter is not present, the local time of the server is used.

Example Usage and Output

<mgiSendMail to="" from="" 
subject="Information Request" mailServer="" 
Information Request

    Name: <mgiFieldContent name="Name">
   Phone: <mgiFieldContent name="Phone">
   Email: <mgiFieldContent name="Email">

The mgiSendMail tag in this example is used to send a formatted email from a form submission. When the email is received at "", it will be in the following format:

Information Request

    Name: Jane Lowe
   Phone: (472) 234-7331

Suggested Usage

  • Form Processing

[Return to the Referencing MGI Menu]

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