Mailets

James provides a number of implemented Mailets for use by James administrators in their configurations. These are primarily mailets that members of the James developer or user communities have found useful in their own configurations. A description of how to configure Mailets and use them in the James SpoolManager can be found here.

AddFooter

Description: This mailet adds a text footer to the message.

Parameters:

  • text (required) - the text that will be added as a footer to the message.

AddHabeasWarrantMark

Description: This mailet adds a Habeas warrant mark (see http://habeas.com for details) to the message.

Parameters: None.

AddHeader

Description: This mailet adds a text header to the message.

Parameters:

  • name (required) - the name of the header to be added to the message.
  • value (required) - the text that will be added as a header to the message.

AvalonListserv

Provides basic list server functionality. Implements basic filters for emails sent to the list, including restriction of senders to members, diallowing attachments in list messages, and subject line processing

Parameters:

  • repositoryName (required) - the name of the user repository that contains the users for this list.
  • membersonly (optional) - whether only members of the list can send messages to this list. Defaults to false.
  • attachmentsallowed (optional) - whether attachments are allowed in messages sent to this list. Defaults to true.
  • replytolist (optional) - whether the reply-to address for all messages sent to this list is set to the list address. Defaults to true.
  • subjectprefix (optional) - a String value. If set, this value is prepended to the subject line of all messages sent to the list.
  • autobracket (optional) - a boolean value. If a subjectprefix is set, this value determines whether the prefix is bracketed before being prepended to the subject line. Defaults to true.

AvalonListservManager

Processes list management commands of the form <list-name>-on@<host> and <list-name>-off@<host> where <list-name> and lt;host> are arbitrary. Note that this should be used in tandem with a CommandForListserv matcher to ensure that only commands intended for a specific list are processed.

Parameters:

  • repositoryName (required) - the name of the user repository that contains the users for this list.

Forward

Description: This mailet forwards the message to a set of recipients.

Parameters:

  • forwardto (required) - a comma delimited list of email addresses.

JDBCAlias

Description: This mailet does alias translation for email addresses stored in a database table.

Parameters:

  • mappings (required) - a URL of the form db://<data-source>/<table>, where <table> is the table in the database containing the alias info and <data-source> is the name of the data-source in config.xml that is to be used.
  • source_column (required) - the column containing the aliases.
  • target_column (required) - the column containing the alias targets.

JDBCVirtualUserTable

Description: This mailet does complex alias translation for email addresses stored in a database table.

Parameters:

  • table (required) - the URL describing the database table. This URL has the form db://<data-source>/<table> where <data-source> and <table> are the names of the data-source as defined in config.xml and the table in the database.
  • sqlquery (optional) - the text of the SQL query used by the mailet to do user lookup. The default is "select VirtualUserTable.target_address from VirtualUserTable, VirtualUserTable as VUTDomains where (VirtualUserTable.user like ? or VirtualUserTable.user like '\\%') and (VirtualUserTable.domain like ? or (VirtualUserTable.domain like '\\%' and VUTDomains.domain like ?)) order by concat(VirtualUserTable.user,'@',VirtualUserTable.domain) desc limit 1"

LocalDelivery

Description: This mailet delivers messages to local mailboxes.

Parameters: None.

NotifyPostmaster

Description: This mailet forwards the message as an attachment to the James postmaster.

Parameters:

  • sendingAddress (optional) - the address from which the forwarded email will be sent. Defaults to the postmaster address.
  • notice (optional) - the text message that will accompany the forwarded message. Defaults to "We were unable to deliver the attached message because of an error in the mail server."
  • attachStackTrace (optional) - whether an error stack trace is attached to the forwarded message.

NotifySender

Description: This mailet forwards the message as an attachment to the original sender.

Parameters:

  • sendingAddress (optional) - the address from which the forwarded email will be sent. Defaults to the postmaster address.
  • notice (optional) - the text message that will accompany the forwarded message. Defaults to "We were unable to deliver the attached message because of an error in the mail server."
  • attachStackTrace (optional) - whether an error stack trace is attached to the forwarded message.

Null

Description: This mailet ends processing for this mail.

Parameters: None.

PostmasterAlias

Description: Intercepts all mails addressed to postmaster@<domain> where <domain> is one of the domains managed by this James server and substitutes the configured James postmaster address for the original recipient address. This mailet is inserted automatically by James at the head of the root processor.

Parameters: None.

Redirect

Description: A mailet providing powerful, configurable redirection services.
This mailet can produce listserver, forward and notify behaviour, with the original message intact, attached, appended or left out altogether.
This built in functionality is controlled by the configuration as described here.

It is also intended to be easily subclassed to make providing bespoke redirection mailets simple.
By extending it and overriding one or more of its methods new behaviour can be quickly created without the author having to address any other issue than the relevant one. For more information see the javadocs here.

Parameters: See javadocs.

RemoteDelivery

Manages delivery of messages to recipients on remote SMTP hosts.

Parameters:

  • outgoing (required) - The URL for the repository that will hold messages being processed by the RemoteDelivery Mailet.
  • delayTime (optional) - a non-negative Long value that is the time in milliseconds between redelivery attempts for a particular mail. Defaults to six hours.
  • maxRetries (optional) - a non-negative Integer value that is number of times the Mailet will attempt to deliver a particular mail. Defaults to five.
  • timeout (optional) - The SMTP connection timeout for SMTP connections generated by this Mailet. Defaults to 60 seconds.
  • deliveryThreads (optional) - The number of threads this Mailet will use to generate SMTP connections.
  • gateway (optional) - The host name of the SMTP server to be used as a gateway for this server. If this value is set, then all messages will be delivered to the gateway server, regardless of recipient address. To specify more than one gateway server, add multiple gateway tags, each containing one value. If more than one server is specified, they will be tried in order until one is successful. In addition the port may be specified for each gateway in the format <host>:<port>. If this value is unset, delivery will occur to SMTP servers resolved by MX lookup.
  • gatewayPort (optional) - The default port number of the SMTP server to be used as a gateway for this server. This value will be employed when a gateway is set and the gateway value does not specify a port as described above.
  • bind (optional) - If present, this value is a string describing the local IP address to which the mailet should be bound while delivering emails. If the tag is absent then the service will bind to the default local address of the machine. This tag is useful for multihomed machines.
    Note: Currently you must use the same IP address for all of those RemoteDelivery instances where you explicitly supply a bind address.
  • debug (optional) - a boolean value (true/false) indicating whether debugging is on. Defaults to false.

ServerTime

Description: This mailet sends a message to the sender of the original mail message with a server timestamp.

Parameters: None.

ToProcessor

Redirects processing of the mail message to the specified processor.

Parameters:

  • processor (required) - the name of the processor to which the message is to be redirected.
  • noticeText (optional) - a String value that, if present, is set as the error message of the redirected message. If this value is not present, no error message is set.

ToRepository

Places a copy of the message in the specified repository.

Parameters:

  • repositoryPath (required) - the URL of the repository to which the message is to be added.
  • passThrough (optional) - a boolean value (true/false) indicating whether processing should continue on the message is on. If false, the original message is GHOSTed. Defaults to false.

UseHeaderRecipients

Description: Ignores the recipients associated with the Mail interface. Instead, it regenerates the mail recipients from the MimeMessage headers (To, Cc, Bcc) and inserts a new message at the queue root these new recipients. The original message is GHOSTed.

Parameters:

  • debug (optional) - a boolean value (true/false) indicating whether debugging is on. Defaults to false.