Transaction

At each SMTP stage, data from the client is received via ‘SMTP commands’. This module lets you query the content of the commands.

fn helo()

Get the value of the `HELO/EHLO` command sent by the client.

Effective smtp stage

helo and onwards.

Return

  • string - the value of the HELO/EHLO command.

Example

#{
    helo: [
       action "log info" || log("info", `${helo()}`),
    ]
}


fn mail_from()

Get the value of the `MAIL FROM` command sent by the client.

Effective smtp stage

mail and onwards.

Return

  • address - the sender address.

Example

#{
    helo: [
       action "log info" || log("info", `${mail_from()}`),
    ]
}


fn mail_timestamp()

Get the time of reception of the email.

Effective smtp stage

preq and onwards.

Return

  • string - the timestamp.

Example

#{
    preq: [
       action "receiving the email" || log("info", `time of reception: ${mail_timestamp()}`),
    ]
}


fn message_id()

Get the unique id of the received message.

Effective smtp stage

preq and onwards.

Return

  • string - the message id.

Example

#{
    preq: [
       action "message received" || log("info", `message id: ${message_id()}`),
    ]
}


fn rcpt()

Get the value of the current `RCPT TO` command sent by the client.

Effective smtp stage

rcpt and onwards. Please note that rcpt() will always return the last recipient received in stages after the rcpt stage. Therefore, this functions is best used in the rcpt stage.

Return

  • address - the address of the received recipient.

Example

#{
    rcpt: [
       action "log recipients" || log("info", `new recipient: ${rcpt()}`),
    ]
}


fn rcpt_list()

Get the list of recipients received by the client.

Effective smtp stage

rcpt and onwards. Note that you will not have all recipients received all at once in the rcpt stage. It is better to use this function in the later stages.

Return

  • Array of addresses - the list containing all recipients.

Example

#{
    preq: [
       action "log recipients" || log("info", `all recipients: ${rcpt_list()}`),
    ]
}