Internet Mail Archive System

From PresenceWiki
Revision as of 16:24, 27 February 2012 by Graham (Talk | contribs)

Jump to: navigation, search
Tutorial Pages > Internet Mail Archive System

Overview

This document describes the IMAS system and how it was created using Presence.

The Imas System currently performs 3 functions:-

  • The Mail Service connects to a POP(email) account and downloads attachments, based on conditions defined under the rules menu.
  • The Rule Service will then copy each attachment to a Network or AS400 location or place it in a folder to be processed by a task service.
  • The Task Service will then process any attachments that need processing, custom tasks can be created for this purpose.

Note: It is the tasks in the task services panel that are bespoke to the specific solution requirement.

Presence Tasks

Queued Processes

Queue Scan POP
Queue Rule Action

On-Demand Processes

OnDemand MainPage (alias imas.mainPage)

Specific DAS Solution

Here, we will study the solution delivered to DAS to give us an overview of the capabilities and operation of IMAS.

The requirement for DAS was to scan an email account for files that can be one of four types:-

  • HomeFixed
  • HomeDelimitted
  • MotorFixed
  • MoterDelimitted

Attachments, can also come through as zipped, in which case we needed to get Presence to unzip them so that it can then treat them as standard attachments.

The first screen here is the imas config screen. IMAS is located in the Presence res/httpdocs directory, so with the both the Presence HTTP Server and the IMAS tasks running, we can go to:-

http://localhost/imas

The first screen we will see is the imas config screen.

http://www.international-presence.com/images/imas/editconfig.png

Here we can define an administrator email, who will get notified of any of exceptions that occur.

As each attachment is processed, the name of the folder that gets created is incremented. We can also see the next folder number as well as define the name of the folder that failed attachments end up in.

Under the AS400 screen we can add and edit AS400 connections.

http://www.international-presence.com/images/imas/editas400.png

Similarly the Email screen allows us to configure which POP accounts we need to be read.

http://www.international-presence.com/images/imas/editemail.png

The rule screen lets us define what happens when we query a pop account.

Each rule is associated with one email account as defined in the previous tabs.

The action to perform can be one of:-

  • Upload To Network Folder
  • Upload To An AS400 (as defined in the AS400 menu)
  • Run A Task

Below the action type, we specify the Task or Network/AS400 folder.

The From Address, allows us to only process emails from a specific address (leave brank to process all the emails in this account).

In Attachment we can specify to only process emails that have a certain type of attachment.

In Filename we can specify to only process emails that have a certain filename match.

Subject allows us to only process emails that match this subject.

Convert XLS to CSV will convert any XLS attachments to CSV attachments.

http://www.international-presence.com/images/imas/editrule.png

The IMAS system works on a file scan basis, so that the 3 separate processes create and process folders in the imas directory.

As an example we will send 1 email that contains a zip file containing one of each file (HomeFixed,HomeDelimitted MotorFixed,MoterDelimitted) as well as an individual file MotorDelimitted.txt and another file Wrong.txt which contains invalid data.

When the Mailservice runs each of these files will be detached and placed in:-

res\imas\scan\basicdetach folder, in a separate folder each:-

ccccccccccc

http://www.international-presence.com/images/imas/basicdetach.png

Note there are 2 files in each folder as one is the trigger folder (imasready).

This Task can be stopped and started using the Mail Service Screen and the logs will describe what is happening.

http://www.international-presence.com/images/imas/mailservice.png

We then need to run the rule service, this will perform the required action on each of the folders created from the Mail Service.

In this case it will run the task "Archive File To AS400". This task actually opens each file and decides whether it is:-

  • HomeFixed
  • HomeDelimitted
  • MotorFixed
  • MoterDelimitted

And places it in the corresponding scan directory. If it can't decide it places it in the Unknown directory:-

All this can be seen on the Rule Service Screen, where again we can view the logs and stop and start this service.

http://www.international-presence.com/images/imas/ruleservice.png

We have added a Custom Task to process each bucket directory. For each type of directory, it will populate a table on the as400 (from the file), and then run a program call on the as400, after which the file will be deleted. To run this Custom Task, we need to


http://www.international-presence.com/images/imas/taskservice.png

http://www.international-presence.com/images/imas/ruleexceptions.png http://www.international-presence.com/images/imas/taskexceptions.png http://www.international-presence.com/images/imas/mailexceptions.png

Importing

You can download the tasks for this example from:- http://www.international-presence.com/wikidocs/samples/On_Demand_Windows_Login.xml

Once imported they should look like:-

http://www.international-presence.com/images/docs/userlogin/tasks.png

To embed the task, we just place the Check Login Sub Task before our normal OnDemand task page as you can see below in Simple Task To Confirm Action.