An automatic reply is simple to set up and has one classic failure: two of them meeting each other. Yours replies to theirs, theirs replies to yours, and the exchange continues until somebody notices.

The three rules

  • Never reply to a message that has Auto-Submitted or Precedence: bulk. That header exists precisely to say do not answer this.
  • Reply once per sender per period. Once a day is normal; once a week is safer.
  • Reply to the ENVELOPE sender, never to the From header. A bounce has an empty envelope sender, and an empty sender is never replied to.
# a vacation reply must carry these
Auto-Submitted: auto-replied
Precedence: bulk
X-Auto-Response-Suppress: All

If you are writing one

# postfix + dovecot sieve
require ["vacation"];
vacation
  :days 7
  :subject "Out of office"
  :addresses ["sara@example.com"]
  "I am away until 20 September. For anything urgent, please write to info@example.com.";

The sieve vacation action already implements all three rules. Writing your own from scratch is how loops happen.

What the message should say

  • When you are back - an actual date.
  • Who to contact instead, with a working address.
  • Nothing about where you are. An out-of-office reply is sent to strangers, including the ones who wrote to a guessed address.
Never set an autoresponder on an address that receives automated mail - orders, alerts, form submissions. It answers every one of them, and if the other end also replies you have built a loop that fills two servers.
Check the mailbox once while it is on. If the sent count is climbing faster than the received count, something is being replied to that should not be.