MailAttachmentDownloaderPluginAPI Namespace |
Mail Attachment Downloader Plugin API allows extending the processing rules and actions performed for emails or attachments. A common scenario for its use would be
to integrate email with other LOB (line of business) applications or cloud applications.
For each email, Mail Attachment Downloader splits the processing of the email into various
phases. The phases are defined below.
- Filter - This determines which emails or attachments are downloaded
- Extraction - This extracts data from the email contents for use in actions
- Process file - Every attachment is saved as per rules defined and processing is performed on the file
- Process email - For every email, processing is performed
- Error - When an error occurs, logs are written and statistics are updated.
This plugin API provides three easy-to-implement interfaces (
IEmailFiltering,
IEmailExtraction and
IEmailProcessing) that enables you as an application developer to plugin to
each of the
phases of processing above while hiding a lot of the complexity of email processing and actions. The following are the functions that are provided.
- ShouldProcessAttachment(String, String, String, String, MailMessage) - This function is invoked during the Filter phase.
Invoked to see if the attachment should be processed, return true if yes or false if not.
- ExtractFromEmail(String, String, String, String, String, MailMessage) - This function is invoked during the Extraction phase.
Use it to extract data from the email and/or attachment to pass back into the program (for example, to use it in a save database action later).
- OnProcessFile(String, String, String, String, String, MailMessage) - This function is invoked during the Process file phase.
When an attachment is saved, this function is invoked. Use it to perform any processing on the file before other rules are run.
- AfterProcessingEmail(String, String, ListString, MailMessage) - This function is invoked during the Process email phase.
After all actions are run and the email has been fully processed, this function is invoked. Use it to perform any final actions on the email.
- OnException(String, String, MailMessage, EmailProcessingException) - This function is invoked during the Error phase.
If any failure occurs, this function is invoked with the processing exceptino message. Use it to record or track errors.
A sample project with an implementation is included. Check the zip file for more information.
Classes Interfaces
| Interface | Description |
---|
| IEmailExtraction |
Extraction plugin interface that offers functions that you can use to pass extractions back for further processing by the program.
Functions specified in this interface may be invoked from multiple threads simultaneously for different emails for parallel processing. You must make sure that the implementation
is thread-safe. For a given email, this will typically only be invoked from a single thread except in the case of an error where a retry may invoke it from another thread.
|
| IEmailFiltering |
Filtering plugin interface that offers functions that you can use to influence which emails or attachments are downloaded.
Functions specified in this interface may be invoked from multiple threads simultaneously for different emails for parallel processing. You must make sure that the implementation
is thread-safe. For a given email, this will typically only be invoked from a single thread except in the case of an error where a retry may invoke it from another thread.
|
| IEmailProcessing |
Processing plugin interface that offers functions that you can use to alter the way the program processes emails or attachments.
Functions specified in this interface may be invoked from multiple threads simultaneously for different emails for parallel processing. You must make sure that the implementation
is thread-safe. For a given email, this will typically only be invoked from a single thread except in the case of an error where a retry may invoke it from another thread.
|