Registering Mail Handler

To register a handler, the following command should be executed:

# mailmng --add-handler

--handler-name=<name>

--handler-type=[global|sender-domain|sender|recipient-domain|recipient]

--handler-type-name=<type-name>

--executable=<handler>

--context=<context>

--hook=[before-queue|before-local|before-remote]

--priority=<number>

 

The arguments are explained in the following table.

Argument

Definition

--handler-name

Specifies the handler name. The string is allowed to contain any character allowed in UNIX file name (that is, anything except slash and NUL). Registration will fail if a handler with the specified name has already been registered.

--handler-type

Specifies the type of a handler, may take the following values:

  • global
    handler is called for all messages.
  • sender-domain
    handler is called for messages whenever the domain part of the sender address matches the specified domain
  • recipient-domain
    handler is called for messages whenever the domain part of one of the recipient addresses matches the specified domain
  • sender
    handler is called for messages whenever the sender address matches the specified address
  • recipient
    handler is called for messages whenever any of the recipient addresses matches the specified address

--handler-type-name

Specifies domain or mail address for handler-type.

Not required if handler type is global.

--priority

Specifies the hook priority in queue of hooks.

--executable

Specifies the handler executable file.

Registration will fail if the file does not exist

--context

Specifies the context. This is an opaque string to be passed to the handler on the command line.

--hook

Specifies the hooking point, should be one of: before-queue, before-local, before-remote

 

The following handler is added to filter correspondence before local delivery:

# mailmng --add-handler

--handler-name=1my_handler-ld

--handler-type=sender

--handler-type-name=myema@example.com

--executable=tmp/handler.sh

--context='context'

--hook=before-local

--priority=33