7.3. HELO

This script is executed on HELO and EHLO. It allows verification of identification.

7.3.1. Variables

These are the pre-defined variables available.

Variable

Type

Read-only

Description

$arguments

array

yes

Context/hook arguments

$connection

array

yes

Connection/session bound

$transaction

array

yes

Transaction bound

$context

any

no

Connection bound user-defined (default none)

7.3.1.1. Arguments

Array item

Type

Example

Description

verb

string

“EHLO”

HELO or EHLO command

host

string

“mail.example.com”

HELO hostname of sender

extensions

array

[“PIPELINING”, “SIZE 1…

The extensions to be sent to the client (if EHLO was issued)

7.3.1.2. Connection

Array item

Type

Example

Description

id

string

“18c190a3-93f-47d7-bd…”

ID of the connection

remoteip

string

“192.168.1.11”

IP address of the connected client

remoteport

number

41666

TCP port of connected client

remoteptr

string

“mail.example.org”

Reverse DNS (FCrDNS) for remoteip (not always available)

remoteuid

number

106

UNIX socket remote user id (not always available)

localip

string

“10.0.0.1”

IP address of the server

localport

number

25

TCP port of the server

serverid

string

“inbound”

ID of the server

tls

array

TLS information (if TLS was started)

auth

array

AUTH information (not always available)

7.3.1.2.1. TLS

Array item

Type

Example

Description

protocol

string

“TLSv1.3”

The protocol

cipher

string

“ECDHE-RSA-AES256-SHA384”

The cipher

keysize

number

256

The keysize

sni

string

“example.com”

The SNI hostname (not always available)

peercert

array

The peer certificate (if provided by the client)

7.3.1.2.1.1. Peercert

Array item

Type

Example

Description

x509

X509Resource

An X509Resource to be used with the X509 class

error

number

18

The peer certificate validation error (see OpenSSLs SSL_get_verify_result(3))

7.3.1.2.2. AUTH

Array item

Type

Example

Description

mechanism

string

“PLAIN”

SASL mechanism (always in uppercase)

username

string

“mailuser”

SASL username (not always available)

7.3.1.3. Transaction

Array item

Type

Example

Description

id

string

“18c190a3-93f-47d7-bd…”

ID of the transaction

7.3.2. Functions

helo.Accept([options])

Accept the HELO or EHLO command. Optionally change the host of the sending client, which is written back to the $connection variable.

Parameters

options (array) – an options array

Returns

doesn’t return, script is terminated

The following options are available in the options array.

  • extensions (array) SMTP service extensions to announce in EHLO responses.

  • host (string) Change the HELO hostname for the current connection.

  • reason (string) First line of the response. The default is the system hostname.

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

helo.Reject([reason[, options]])

Reject the HELO or EHLO command with a permanent (554) error.

Parameters
  • reason (string or array) – reject message with reason

  • options (array) – an options array

Returns

doesn’t return, script is terminated

The following options are available in the options array.

  • disconnect (boolean) Disconnect the client. The default is false.

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

helo.Defer([reason[, options]])

Defer the HELO or EHLO command with a temporary (450) error.

Parameters
  • reason (string or array) – defer message with reason

  • options (array) – an options array

Returns

doesn’t return, script is terminated

The following options are available in the options array.

  • disconnect (boolean) Disconnect the client. The default is false.

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

7.3.3. On script error

On script error Defer() is called.

7.3.4. On implicit termination

If not explicitly terminated then Accept() is called.