mailproc-registermailproc-register
Register a mailprocessor with a MailTransport
Home > Books > NetKernel API and Services Reference > Accessor Listing > SMTP Email Service > mailproc-register

Rate this page:
Really useful
Satisfactory
Not helpful
Confusing
Incorrect
Unsure
Extra comments:


Module

urn:org:ten60:netkernel:mod:smtp

The mailproc-register accessor is exported by the urn:org:ten60:netkernel:mod:smtp module. Import this module to gain access to the accessor.

Syntax

URI
active:mailproc-register

ArgumentRulesDescription
idMandatory A URI to use to identify the mailprocessor
configMandatory A mailprocessor configuration

Example Usage

DPML

<instr>
  <type>mailproc-register</type>
  <id>urn:org:ten60:mail:mailprocessor:1</id>
  <config>config.xml</config>
</instr>

NetKernel Foundation API

req=context.createSubRequest("active:mailproc-register");
req.addArgument("id", [resource representation, aspect, or URI] );
req.addArgument("config", [resource representation, aspect, or URI] );
result=context.issueSubRequest(req);

Purpose

The mailproc-register accessor registers a new mailprocessor with a MailTransport.

A mailprocessor periodically polls a mailserver to check for unprocessed messages. All unprocessed messages are issued as arguments to a service URI specified in the mailprocessor config. A newly registered mailprocessor is idle and will only commence polling when started by mailproc-start.

The MailTransport which receives the mailprocessor registration is located dynamically and is discovered from the first instance of ffcpl:/etc/MailTransportConfig.xml in the current module address space.

For more information on the operation of the MailTransport see the MailTransport guide.

Configuration

A mailprocessor has the following configuration...

<mailProcessor>
  <type>pop | imap</type>
  <host>hostname of mailserver</host>
  <username />
  <password />
  <processURI>the URI which will be invoked with each processed message</processURI>
  <pollInterval>time interval in ms at which mailbox will be polled</pollInterval>
  <filters>
    <rule>
      <field>to | cc | subject | body</field>
      <match>a regex pattern to match the field against</match>
    </rule> ...Any number of filter rules may be added here...
  </filters>
  <options>
    <maxRetries />
    <deleteProcessed />
    <preserveFiltered />
  </options>
</mailProcessor>

Any number of filters may be applied to the messages in the mailbox. Only messages which match the filters will be processed. If no filters are specified all messages are processed.

The default behaviour of a mailprocessor is to retry a mailbox 3 times, to mark processed messages as read and to delete messages which fail the filter criteria. The defaults may be modified with the following options...

mailFolder the name of the mailfolder to use to locate messages (note: only valid with IMAP mailservers, defaults to INBOX).
maxRetries the number of times to attempt to process a mailbox before shutting down the mailprocessor. A value of -1 means never shutdown.
deleteProcessed after processing delete the message. Generally pop mailboxes should set this option to avoid processing loops.
preserveFiltered by default messages which do not successfully pass the filtering stage are deleted. This option preserves these messages but marks them as read.

© 2003-2007, 1060 Research Limited. 1060 registered trademark, NetKernel trademark of 1060 Research Limited.