Skip to main content

Answer Automatically While You Are Away in Zimbra

Every guide to Sieve auto-replies starts with the vacation command from RFC 5230, which answers each correspondent once and knows to stay quiet on mailing lists. None of that applies here, because Zimbra does not implement vacation. It has its own reply action, which is simpler and considerably less careful, and using it safely means supplying by hand the protections vacation would have given you.

Part of the series on Everyday Uses for Sieve Mail Filters in Zimbra.

What Zimbra actually has

vacation is absent from Zimbra's Sieve keyword registry, so a script using it is a syntax error rather than something that quietly misbehaves. In its place:

require ["reply"];

reply "I am out of the office until 6 October and will answer on my return.";

reply takes exactly one string, the body of the reply, and sends it to the sender.

That is the entire feature. It has no :days to limit how often one person is answered, no :addresses to tell it which addresses are yours, and no built-in suppression of automated mail. Written as above, with no condition, it answers every single message that arrives - including newsletters, including delivery failure notices, and including the auto-reply from the other person who is also away.

Making it safe

A usable reply rule is mostly conditions. Each one below replaces something vacation would have done for you.

require ["reply", "envelope"];

if allof (
# Not bulk mail, newsletters or list traffic.
not bulk,
not list,

# Not an automatic message. RFC 3834 asks every auto-reply to say so.
not exists "Auto-Submitted",
not header :contains "Precedence" ["bulk", "list", "junk"],

# Not a bounce - delivery failure notices have an empty envelope sender.
not envelope :all :is "from" "",

# Addressed to me, rather than to a list I happen to be on.
me :in "to,cc"
) {
reply "I am out of the office until 6 October and will answer on my return.";
}

The Auto-Submitted test is the important one. RFC 3834 asks every automatic responder to stamp its messages with that header, which means two well-behaved auto-repliers will not talk to each other forever. Zimbra's own out-of-office replies carry it, so this one condition prevents the classic loop between two absent colleagues.

The bounce test matters for a different reason. A delivery failure notice arrives with an empty envelope sender precisely so that nothing replies to it. Replying anyway creates mail that cannot be delivered, which generates another bounce.

What is still missing

Even with all of that, one thing cannot be reproduced: reply answers every matching message, not one per sender. A colleague who writes to you five times gets five identical replies.

Sieve has no memory between messages, so there is no way to fix this in the script. If answering once per person matters - and for most absences it does - use the feature that was built for it.

The built-in out-of-office is usually the right answer

Zimbra has a proper out-of-office responder that is not Sieve at all. It lives under Preferences > Out of Office in the web client, and it does the things reply cannot: it answers each sender only once within a configurable interval, it has a start and end date so it turns itself off, and it can show a different message to people outside the organization.

# the same thing from the command line
sudo su - zimbra

zmprov ma user@example.com zimbraPrefOutOfOfficeReplyEnabled TRUE
zmprov ma user@example.com zimbraPrefOutOfOfficeReply "Away until 6 October."
zmprov ma user@example.com zimbraPrefOutOfOfficeFromDate 20261001000000.000Z
zmprov ma user@example.com zimbraPrefOutOfOfficeUntilDate 20261006000000.000Z

Reach for Sieve reply when you need something out-of-office cannot express: an acknowledgement on one address only, a different answer for one sender, a reply that depends on the subject.

Where Sieve reply genuinely wins

The case reply is actually good at is a shared address that should acknowledge everything, every time - where answering repeatedly is the feature rather than the bug:

require ["reply", "envelope", "fileinto"];

if allof (envelope :is "to" "support@example.com",
not bulk,
not exists "Auto-Submitted") {
reply "Thank you. Your message has reached our support team and we will answer within one business day.";
fileinto "Support";
stop;
}

Here every message should be acknowledged, so the absence of once-per-sender logic stops being a problem.

Applying it

reply needs no special configuration and works in a user filter or an admin script.

In the web client, under Preferences > Filters, the action is called Reply.

The Filters page in the Zimbra web client preferences, with the Incoming Message Filters and Outgoing Message Filters tabs and the Create Filter, Edit Filter, Delete Filter and Run Filter buttons

From the command line, for one user:

sudo su - zimbra
zmprov ma user@example.com zimbraMailSieveScript "$(cat /tmp/reply.sieve)"

Test it by writing from an outside account, then check two things: that you received exactly one reply, and that writing again produces another one. That second result is expected with reply, and seeing it is the quickest way to decide whether you want the built-in out-of-office instead.

One more thing to check

Mail that Sieve sends goes back out through the mail path, so an auto-reply passes the outbound rules on the way. If you run a disclaimer or signature product, the reply will collect one. That is usually harmless and occasionally strange, and it is easy to miss because you never see your own auto-replies. Send one to an outside address and look at what arrives.

Next in this series

Back to Everyday Uses for Sieve Mail Filters in Zimbra, or on to Keep Automated Alerts and Reports Out of the Inbox.