7.1. CONNECT

The CONNECT context is executed before the SMTP banner is sent.

7.1.1. Pre-defined variables

These are the read-only pre-defined variables available for each connection that is established.

Variable Type Example Description
$messageid string “18c190a3-93f-47d7-bd...” ID of the message
$senderip string “192.168.1.11” IP address of the connected client
$senderport number 41666 TCP port of connected client
$serverip string “10.0.0.1” IP address of the mailserver
$serverport number 25 TCP port of the mailserver
$serverid string “mailserver:1” ID of the mailserver profile

These are the writable pre-defined variables available.

Variable Type Description
$context any Connection-bound variable

7.1.2. Functions

connect.Accept()

Allow SMTP connection to be established.

Returns:doesn’t return, script is terminated
connect.Reject([reason[, options]])

Reject the connection with a permanent (521) error.

Parameters:
  • reason (string) – the reject message
  • options (array) – an options array
Returns:

doesn’t return, script is terminated

The following options are available in the options array.

  • reply_codes (array) The array may contain code (number) and enhanced (array of three numbers). The default is pre-defined.
connect.Defer([reason[, options]])

Defer the connection with a temporary (421) error.

Parameters:
  • reason (string) – the defer message
  • options (array) – an options array
Returns:

doesn’t return, script is terminated

The following options are available in the options array.

  • reply_codes (array) The array may contain code (number) and enhanced (array of three numbers). The default is pre-defined.

7.1.3. On script error

On script error Defer() is called.

7.1.4. On implicit termination

If not explicitly terminated then Accept() is called.