The mgiPOP Tag

Tag Behavior

The mgiPOP tag communicates with a POP email server to directly read, delete and send emails or download email from a POP email server into an MGI database. The mgiPOP tag includes quoted-printable and encoded word support for many non-English language characters.


Tag Syntax

The mgiPOP tag has five required parameters and no optional parameters for all modes. In addition, the mgiPOP tag has required and optional parameters for specific modes. The tag form is:

<mgiPOP mode="Mode" username="POP Username" password="POP Password" 
email="Email Address" popServer="Server Address">

Required Parameters for All Modes:

  • mode="Mode" where "Mode" is the function of the mgiPOP tag. Valid modes include:
    • Window mode communicates directly with a POP email server to read, reply, forward and compose email messages. Messages are not downloaded to the web server in window mode. (1 additional required parameter and 7 optional parameters- see below for details). Note: in order to reply, forward and compose new messages in Window mode, the mgiSendMail tag must be installed.
    • Client mode downloads email from a POP email server to an MGI database. The database is named "MGIPOPDB" and a table is created in the database for each pop user in the format "username@popServer" (see database field names below). Customizable functions used in conjunction with client mode allows you to read, reply, forward and compose email messages. (1 optional parameter and 3 variables- see below for details).
    • DeleteServerMessage mode is used in conjunction with Client mode to delete messages from the POP email server. (1 additional required parameter- see below for details).
    • DeleteMessage mode is used in conjunction with Client mode to delete messages from the MGI POP database and from the POP email server. (1 additional required parameter- see below for details).
    • GetMessageCount mode displays the current number of messages on the POP email server.
  • username="POP Username" where "POP Username" is the login ID for the POP email account. Depending on your email server, the username may or may not be case-sensitive.
  • password="POP Password" where "POP Password" is the security code for the POP email account. Depending on your email server, the password may or may not be case-sensitive.
  • email="Email Address" where "Email Address" is the email address associated with the POP email account (e.g., name@domain.com).
  • popServer="Server Address" where "Server Address" is the canonical name or IP address of the email server to retrieve incoming email messages (e.g., pop.domain.com). The form of the POP server address depends on the configuration of the email server.

Optional Parameters for All Modes:

  • None.

Window Mode Required Parameters:

  • smtpServer="Server Address" where "Server Address" is the canonical name or IP address of the email server to send outgoing SMTP email messages (e.g., mail.domain.com). The form of the SMTP server address depends on the configuration of the email server.

Window Mode Optional Parameters:

  • headerColor="Hex Color" where "Hex Color" is the hexadecimal color designation for the first row of the Window mode interface.
  • rowColor1="Hex Color" where "Hex Color" is the hexadecimal color designation for the odd rows of messages in the Window mode interface.
  • rowColor2="Hex Color" where "Hex Color" is the hexadecimal color designation for the even rows of messages in the Window mode interface.
  • headerTextColor="Hex Color" where "Hex Color" is the hexadecimal color designation for the text in the first row of the Window mode interface.
  • rowTextColor1="Hex Color" where "Hex Color" is the hexadecimal color designation for the text in the odd rows of messages in the Window mode interface.
  • rowTextColor2="Hex Color" where "Hex Color" is the hexadecimal color designation for the text in the even rows of messages in the Window mode interface.
  • displayLimit="Integer" where "Integer" is the number of email messages (between 1 and 10) to display on each page of the Window mode interface. If more messages are available, previous and next buttons will appear in the last row of the "Operation" column for navigation between sets of messages. The default display limit is "5". The maximum display limit is "10".

Client Mode Optional Parameters:

  • deleteMessagesOnServer="Yes/No" where "Yes" indicates that messages are deleted from the POP email server as they are downloaded to the MGI POP database and "No" indicates that messages remain on the POP email server after they are downloaded to the MGI POP database. The default is "No". Even if messages are kept on the POP email server, duplicate message are not downloaded to the MGI POP database when mgiPOP in Client mode is subsequently accessed. Each message that is downloaded is marked as Unread in the "Read" boolean database field. The "Read" boolean database field can be used to indicate which messages are new and unread. Messages can be deleted individually off the POP email server using the Delete Message mode in conjunction with Client mode.

Client Mode Variables: When the mgiPOP tag in Client mode is parsed, the following page variables are set. These variables are available for display anywhere on the page after the mgiPOP tag in Client mode. To display information in a page variable, use the mgiGet tag with the following syntax:

<mgiGet name="VariableName">
  • mgiPOP_NewMessageCount - Displays the number of new messages that were downloaded.
  • mgiPOP_TotalMessageCount - Displays the total number of messages currently on the POP email server.
  • mgiPOP_TotalMessageSize - Displays the total size of all messages currently on the POP email server.

Client Mode Database Field Names: When email is downloaded from a POP email server to an MGI database using Client mode, the database is named "MGIPOPDB" and a table is created in the database for each pop user in the format "username@popServer". Each email message is parsed and entered into the following database fields.

  • Email ID (integer) - serial ID number assigned by the mgiPOP tag.
  • Header (long text) - full email header.
  • Message (long text) - body of message (including attachments).
  • Read (boolean) - all messages entered as "False" indicating that they are unread.
  • Unique ID (short text) - unique ID of message assigned by the mail server.
  • To (short text) - parsed email header information.
  • From (short text) - parsed email header information.
  • From Name (short text) - parsed email header information.
  • From Email (short text) - parsed email header information.
  • Date (short text) - parsed email header information.
  • Subject (short text) - parsed email header information.
  • Size (short text) - parsed email header information.
  • Return-Path (short text) - parsed email header information.
  • Received (short text) - parsed email header information.
  • X-Sender (short text) - parsed email header information.
  • Message-ID (short text) - parsed email header information.
  • Mime-Version (short text) - parsed email header information.
  • Content-Type (short text) - parsed email header information.
  • Status (short text) - parsed email header information.

DeleteServerMessage and DeleteMessage Mode Required Parameters:

  • messageID="Unique ID" where "Unique ID" is the unique identifier of the email message from the POP email server. Each downloaded message has a unique message ID that is stored in the MGI POP database field "Unique ID". In DeleteServerMessage mode, the email message is deleted from the POP email server only (and is not deleted from the MGI POP database). In DeleteMessage mode, the email message is deleted from the POP email server and the MGI POP database.


Example Usage and Output

Window Mode

<mgiPOP mode="window" username="asmith4" password="Df83445vg"
popServer="pop.pageplanet.com" smtpServer="mail.pageplanet.com" 
email="asmith@pageplanet.com" headerColor="#000000" rowColor1="#ff0000"
rowColor2="#ffffff" headerTextColor="#ffffff" rowTextColor1="#ffffff"
rowTextColor2="#ff0000" displayLimit="10">

The window mode of mgiPOP has a standard web-based interface (with Customizable colors and number of messages listed per page). The following is the default look of mgiPOP in window mode:

In window mode, a message is deleted from the server (and thus, no longer available) when you click the "Delete" button.

Client Mode

<mgiPOP mode="client" username="asmith4" password="Df83445vg"
popServer="pop.pageplanet.com" email="asmith@pageplanet.com"
deleteMessagesOnServer="yes">

In client mode, the mgiPOP tag downloads email messages into an MGI database named "MGIPOPDB" in the same folder as the page the contains the mgiPOP tag. A table is created for each mgiPOP user in the same folder. The name of the table is "username@popServer" (e.g., asmith4@pop.pageplanet.com). Client mode only downloads emails from the POP server to the MGI database and does not display the emails.

Delete Server Message Mode

<mgiPOP mode="deleteServerMessage" username="asmith4" password="Df83445vg"
popServer="pop.pageplanet.com" email="asmith@pageplanet.com"
messageID={mgiFieldContent name="messageID"}>

The Delete Server Message mode is a tool to use in conjunction with a customized Client mode of mgiPOP. In a custom interface, you might pass the email's unique ID in the form of a post argument and delete that email from the server only when a "Delete From Server" button is clicked, for example. The Delete Server Message mode does not display a status message when complete.

Delete Message Mode

<mgiPOP mode="deleteMessage" username="asmith4" password="Df83445vg"
popServer="pop.pageplanet.com" email="asmith@pageplanet.com"
messageID={mgiFieldContent name="messageID"}>

The Delete Message mode is a tool to use in conjunction with a customized Client mode of mgiPOP. In a custom interface, you might pass the email's unique ID in the form of a post argument and delete that email from the server AND from the MGI POP database that contains the message when a "Delete Message" button is clicked, for example. The Delete Message mode does not display a status message when complete.

Get Message Count Mode

<mgiPOP mode="getMessageCount" username="asmith4" password="Df83445vg"
popServer="pop.pageplanet.com" email="asmith@pageplanet.com">

The Get Message Count mode displays the number of messages currently residing on the POP email server. This mode can be integrated into a custom Client mode interface.


Suggested Usage

  • Web-Based Email
  • Trouble-Ticket Tracking System
  • Automated Classified Ad System


[Return to the Referencing MGI Menu]


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