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 theFromheader.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 FROMcommand. Possible values are7bit,8bitmimeandbinarymime.env.param.smtputf8: Set totrueif the SMTPUTF8 flag was specified in theMAIL FROMcommand.env.param.requiretls: Set totrueif the REQUIRETLS flag was specified in theMAIL FROMcommand.
Envelope
The envelope contents can be accessed using the envelope test or through variables:
envelope.from: The return path specified in theMAIL FROMcommand.envelope.to: The recipient address specified in the lastRCPT TOcommand.envelope.notify: TheNOTIFYextension parameters.envelope.orcpt: TheORCPTvalue specified with the DSN extension.envelope.ret: TheRETvalue specified with the DSN extension.envelope.envid: TheENVIDvalue specified with the DSN extension.envelope.by_time_absolute: The specified absolute time in theDELIVERBYextension.envelope.by_time_relative: The specified relative time in theDELIVERBYextension.envelope.by_mode: The mode specified with theDELIVERBYextension.envelope.by_trace: The trace settings specified with theDELIVERBYextension.
Please note that user scripts executed within the untrusted interpreter only have access to the From and To parts of the envelope.