Downloading Email to an MGI Database

Example

Downloading emails from a POP email account to an MGI database.

MGI Tags

  • mgiPOP

Steps

  1. Create an email processing page.
  2. Save the email processing page.
  3. Open the email processing page in a text editor.
  4. Insert the mgiPOP tag in client mode.
  5. Save the email processing page.
  6. FTP the email processing page to the web server running MGI.
  7. Access the email processing page.


Step 1: Create an email processing page.

Create a new HTML page to download emails from the POP email server to an MGI database. When emails are downloaded from the server to an MGI database, the mgiPOP tag in client mode does not display a status message, therefore a hard-coded message might be helpful when the page is displayed.
 
Insert your cursor after the <BODY> tag and enter a paragraph tag and a status message.
<p>Emails from the susang@domain.com account have been downloaded. 

Step 2: Save the email processing page.

Save the email processing page and name it "emailtodb.mgi".

Step 3: Open the email processing page in a text editor.

Open the email processing page in a text editing program that allows you to view and modify HTML.

Step 4: Insert the mgiPOP tag in client mode.

After the status message, enter the mgiPOP tag, mode parameter, username parameter, password parameter, popServer parameter, email parameter and deleteMessagesOnServer parameter.
 
In the mode parameter, enter "Client". In the username parameter, enter your username for the POP email account. In the password parameter, enter your password for the POP email account. In the popServer parameter, enter the address of the incoming POP server for your email account. In the email parameter, enter your email address for the POP email account. In the deleteMessagesOnServer parameter, enter "Yes" or "No". If you enter "Yes", messages are deleted from the POP email server as they are downloaded to the MGI database. If you enter "No", messages are not deleted from the POP email server as they are downloaded to the MGI database. 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.
<mgiPOP mode="client" username="susang1" password="8824b44J"
popServer="pop.domain.com" email="susang@domain.com"
deleteMessagesOnServer="yes">

Step 5: Save the email processing page.

Save the changes you have made to the email processing page.

Step 6: FTP the email processing page to the web server running MGI.

Upload your the email processing page to the web server running MGI.

Step 7: Access the email processing page.

Access the email processing page (emailtodb.mgi). When you access the page, emails are retrieved from the POP account, parsed into the database field listed below, and added to the database (1 record per email). Using the additional functions of mgiPOP and other MGI tags, you can create a custom email interface or other function to use the information in the email database.
 
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" (e.g., susang1@pop.domain.com). 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.


[Return to the Using Web Based Email Menu]


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