After some additional research and testing, it seems that my vacation auto-reply is working when the sender doesn't have the same username (%n) as a local account on the recipient imap server.

If test@xyz.com sends an email to  test2@example.com, the vacation auto-reply is triggered but delivered to the wrong mailbox.

Suppose I have an account test@example.com on my imap server, this account has the same %n (test) as the sender address.

In this case the vacation auto-reply is delivered locally to the test@example.com account instead of test@example.xyz

If I delete the test@example.com account from my imap server then the vacation auto-reply is send through my relayhost and delivered to original sender as expected.

Now I need to figure out how to solve this problem.


Le lun. 3 déc. 2018 à 16:07, fins <svinz82@gmail.com> a écrit :

Hello,


I have a complete Postfix + Dovecot + openLDAP setup almost working, the only issue I have is the vacation script auto-reply that doesn't work properly.

If I send an email to a user with the vacation filter enabled, the auto-reply is send to a local recipient with the same account name.

So for example if I send a mail from test@xyz.com to test@example.com, the auto-reply is received on the test@example.com address instead of the test@xyz.com who's the original sender.

Here's a log file:


Dec  3 13:52:48 imap dovecot: lda(test@example.com): Debug: sieve: executing script from /var/mail/example.com/test/.dovecot.svbin
Dec  3 13:52:48 imap dovecot: lda(test@example.com): sieve: msgid=<dovecot-sieve-1543841568-836314-0@imap.example.com>: discarding vacation response to auto-submitted message from <MAILER-DAEMON>
Dec  3 13:52:48 imap dovecot: lda(test@example.com): sieve: msgid=<dovecot-sieve-1543841568-836314-0@imap.example.com>: stored mail into mailbox 'INBOX'
Dec  3 13:52:48 imap postfix/pipe[6663]: D835A300E05: to=<test@example.com>, orig_to=<test@xyz.com>, relay=dovecot, delay=0.1, delays=0.03/0.01/0/0.06, dsn=2.0.0, status=sent (delivered via dovecot service)


Can somebody help with this issue and/or point where to go for debugging?


Please find my dovecot configuration bellow:



dovecot -n
# 2.2.10: /etc/dovecot/dovecot.conf
# OS: Linux 3.10.0-862.11.6.el7.x86_64 x86_64 CentOS Linux release 7.5.1804 (Core)  xfs
auth_debug = yes
auth_mechanisms = plain login
auth_verbose = yes
lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes
mail_debug = yes
mail_gid = mail
mail_home = /var/mail/%d/%n
mail_location = maildir:/var/mail/%d/%n/Maildir
mail_plugins = " quota"
mail_uid = vmail
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave
mbox_write_locks = fcntl
namespace inbox {
  inbox = yes
  location = 
  mailbox Drafts {
    special_use = \Drafts
  }
  mailbox Junk {
    special_use = \Junk
  }
  mailbox Sent {
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    special_use = \Sent
  }
  mailbox Trash {
    special_use = \Trash
  }
  prefix = 
}
passdb {
  args = /etc/dovecot/dovecot-ldap.conf.ext
  driver = ldap
}
plugin {
  quota = maildir:User quota
  quota_grace = 10%%
  quota_rule2 = Trash:storage=+100M
  quota_status_nouser = DUNNO
  quota_status_overquota = 552 5.2.2 Mailbox is full
  quota_status_success = DUNNO
  quota_warning = storage=95%% quota-warning 95 %u it
  quota_warning2 = storage=80%% quota-warning 80 %u it
  sieve = ~/.dovecot.sieve
  sieve_dir = ~/sieve
}
protocols = imap pop3 lmtp sieve
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0666
    user = postfix
  }
  unix_listener auth-userdb {
    group = mail
    mode = 0600
    user = vmail
  }
}
service imap-login {
  inet_listener imap {
    port = 0
  }
}
service managesieve-login {
  inet_listener sieve {
    port = 4190
  }
}
service pop3-login {
  inet_listener pop3 {
    port = 0
  }
  inet_listener pop3s {
    port = 0
  }
}
service quota-status {
  client_limit = 1
  executable = quota-status -p postfix
  inet_listener {
    port = 12340
  }
}
service quota-warning {
  executable = script /usr/local/bin/quota-warning.sh
  unix_listener quota-warning {
    user = vmail
  }
  user = vmail
}
ssl = required
ssl_cert = </etc/pki/tls/certs/imap.example.com.crt
ssl_key = </etc/pki/tls/private/imap.example.com.key
userdb {
  args = /etc/dovecot/dovecot-ldap.conf.ext
  driver = ldap
}
protocol lda {
  mail_plugins = " quota sieve"
}
protocol imap {
  mail_plugins = " quota imap_quota"
}



dovecot-ldap.conf.ext


hosts =  example.com
base = ou=People,dc=example,dc=com
ldap_version = 3
auth_bind = yes
user_filter = (&(objectClass=posixAccount)(uid=%n))
pass_filter = (&(objectClass=posixAccount)(uid=%n))

user_attrs = \
 mailRoutingAddress=user, \
 =uid=vmail, \
 =gid=mail, \
 =home=/var/mail/%d/%n, \
 =quota_rule=*:bytes=%{ldap:departmentNumber}


pass_attrs= mailRoutingAddress=user

tls = yes


My vacation script:


require ["date","relational","vacation"];
# rule:[Vacation]
if allof (currentdate :zone "+0100" :value "ge" "iso8601" "2018-12-02T02:00:00+01:00", currentdate :zone "+0100" :value "le" "iso8601" "2018-12-24T04:00:00+01:00")
{
    vacation :addresses "test@example.com" :subject "Away" "I'm away";
}