I have set up my email server following the ISPMail tutorial with virtual users in postfix + dovecot + sieve. My problem is: the envelop "variable" in sieve does not contain the original recipient.
I have a mail account, let's call it [email protected] and additional aliases set up for postfix which all deliver to the aforementioned address:
[email protected] -> [email protected] @domain.com -> [email protected] The latter being an catch-all address.
Postfix calls dovecot with the following config line in master.cfg:
dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/dovecot-lda -f ${sender} -d ${user}@${nexthop} -a ${recipient} With sieve I want to put all mails received for the catch-all address into a specific folder. My sieve code looks like this:
if envelope :is :domain "To" "domain.com" { fileinto "special-folder"; } This sadly does not work. Digging further I found out that what's inside envelop always is the final delivery address, i.e. [email protected] in this case. I found this using the following rule:
if envelope :matches "To" "*" { fileinto "${1}"; } And the sieve log telling me:
failed to store into mailbox '[email protected]': Mailbox doesn't exist: [email protected]. I'm already guessing that this has to be a problem somewhere between postfix and dovecot as the mail log tells me the following:
Aug 29 10:38:27 *** dovecot: lda([email protected]): sieve: msgid=<54003C01.1080704@***>: stored mail into mailbox 'INBOX' Aug 29 10:38:27 *** dovecot: lda([email protected]): Error: sieve: execution of script /var/vmail/example.org/mail/dovecot.sieve failed, but implicit keep was successful (user logfile /var/vmail/example.org/mail/dovecot.sieve.log may reveal additional details) Aug 29 10:38:27 *** postfix/pipe[12469]: A31A28006B: to=<[email protected]>, orig_to=<[email protected]>, relay=dovecot, delay=0.29, delays=0.18/0.01/0/0.1, dsn=2.0.0, status=sent (delivered via dovecot service) Obviously postfix states the original recipient ([email protected]) and the mailbox delivered to ([email protected]) but somehow this information gets lost on the way to dovecot?!