Click or drag to resize
IEmailProcessing Interface
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.

Namespace: MailAttachmentDownloaderPluginAPI
Assembly: MailAttachmentDownloaderPluginAPI (in MailAttachmentDownloaderPluginAPI.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public interface IEmailProcessing

The IEmailProcessing type exposes the following members.

Methods
  NameDescription
Public methodAfterProcessingEmail
This is invoked after processing emails including any configured post download action. This is invoked only once for every email. Any processing must be idempotent.

This function may be invoked from multiple threads simultaneously for different emails for parallel processing.

public void AfterProcessingEmail(string account, string uniqueID, List<string> processedFiles, MailMessage message)
{
    Console.WriteLine("Processed email: " + message.Subject);
}
Public methodOnException
On any exception when downloading or processing the email or attachment this is called. Use this to perform any custom recording of errors if needed.

This function may be invoked from multiple threads simultaneously for different emails for parallel processing.

Example below shows how to just print the Exception message out to the Console.

public void OnException(string account, string uniqueID, MailMessage message, EmailProcessingException e);
{
    Console.WriteLine(e.Message);
}
Public methodOnProcessFile
After the attachment is downloaded or after any processing has occured, this function is called. You can perform post-download actions here for a given file. Any processing must be idempotent.

Note that for a given attachment, this function may be invoked many times. An example of such a case would be where processing is performed on a zip file. This would be invoked once for the zip file and then if the Unzip action was used, once for every file inside of the zip file. You can choose to do further processing based on the type of file if needed.

This function may be invoked from multiple threads simultaneously for different emails for parallel processing.

Example below shows how to just print the savedFilename out to the Console.

public void OnProcessFile(string account, string ruleName, string savedFilename, string attachmentFilename, string uniqueID, MailMessage message)
{
    Console.WriteLine(savedFilename);
}
Top
See Also