Variables
Sieve scripts have access to a number of variables that can be used to obtain information about the current SMTP session, the message being processed and the environment in which the script is executed.
Environment
The following environment variables can be accessed from within a Sieve script executed in the trusted interpreter:
env.remote_ip
: The email client's IP address.env.remote_ip.reverse
: The reversed IP address label to be used in DNS lookups.env.helo_domain
: The domain name used in the EHLO/LHLO command.env.authenticated_as
: The account name used for authentication.env.from
: The sender's email address specified in theFrom
header.env.spf.result
: The result of the SPF MAIL FROM check.env.spf_ehlo.result
: The result of the SPF EHLO check.env.dkim
: The result of the DKIM check.env.dkim.domains
: The domains names that have passed DKIM validation.env.arc.result
: The result of the ARC check.env.dmarc.result
: The result of the DMARC check.env.dmarc.policy
: The DMARC policy that was applied.env.iprev.result
: The result of the reverse IP check.env.iprev.ptr
: The host name returned by the reverse IP check.env.tls.version
: The TLS version used for the current session.env.tls.cipher
: The TLS cipher used for the current session.env.stage
: The current stage of the SMTP transaction.env.now
: The current date and time in seconds since the Unix epoch.env.param.body
: The body flag specified in theMAIL FROM
command. Possible values are7bit
,8bitmime
andbinarymime
.env.param.smtputf8
: Set totrue
if the SMTPUTF8 flag was specified in theMAIL FROM
command.env.param.requiretls
: Set totrue
if the REQUIRETLS flag was specified in theMAIL FROM
command.
Envelope
The envelope contents can be accessed using the envelope test or through variables:
envelope.from
: The return path specified in theMAIL FROM
command.envelope.to
: The recipient address specified in the lastRCPT TO
command.envelope.notify
: TheNOTIFY
extension parameters.envelope.orcpt
: TheORCPT
value specified with the DSN extension.envelope.ret
: TheRET
value specified with the DSN extension.envelope.envid
: TheENVID
value specified with the DSN extension.envelope.by_time_absolute
: The specified absolute time in theDELIVERBY
extension.envelope.by_time_relative
: The specified relative time in theDELIVERBY
extension.envelope.by_mode
: The mode specified with theDELIVERBY
extension.envelope.by_trace
: The trace settings specified with theDELIVERBY
extension.
Please note that user scripts executed within the untrusted interpreter only have access to the From
and To
parts of the envelope.