<div dir="ltr"><p>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.</p>
<p>If <a href="mailto:test@xyz.com">test@xyz.com</a> sends an email to  <a href="mailto:test2@example.com">test2@example.com</a>, the vacation auto-reply is triggered but delivered to the wrong mailbox. <br></p><p>Suppose I have an account <a href="mailto:test@example.com">test@example.com</a> on my imap server, this account has the same %n (test) as the sender address.<br></p>
<p>In this case the vacation 
auto-reply is delivered locally to the <a href="mailto:test@example.com">test@example.com</a> account instead of 
<a href="mailto:test@example.xyz">test@example.xyz</a><br>
</p>
<p>If I delete the <a href="mailto:test@example.com">test@example.com</a> account from my imap server then the
 vacation auto-reply is send through my relayhost and delivered to 
original sender as expected.<br>
</p>
<p>Now I need to figure out how to solve this problem.</p>
</div><br><div class="gmail_quote"><div dir="ltr">Le lun. 3 déc. 2018 à 16:07, fins <<a href="mailto:svinz82@gmail.com">svinz82@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><p>Hello,</p>
<p><br>
</p>
<p>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.<br></p>
<p>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.</p>
<p>So for example if I send a mail from <a href="mailto:test@xyz.com" target="_blank">test@xyz.com</a> to 
<a href="mailto:test@example.com" target="_blank">test@example.com</a>, the auto-reply is received on the <a href="mailto:test@example.com" target="_blank">test@example.com</a> address instead of the <a href="mailto:test@xyz.com" target="_blank">test@xyz.com</a> who's the original sender.<br>
</p>
<p>Here's a log file:</p>
<p><br>
</p>
<p>Dec  3 13:52:48 imap dovecot: lda(<a href="mailto:test@example.com" target="_blank">test@example.com</a>): Debug: sieve: 
executing script from /var/mail/<a href="http://example.com/test/.dovecot.svbin" target="_blank">example.com/test/.dovecot.svbin</a><br>
Dec  3 13:52:48 imap dovecot: lda(<a href="mailto:test@example.com" target="_blank">test@example.com</a>): sieve: 
msgid=<<a href="mailto:dovecot-sieve-1543841568-836314-0@imap.example.com" target="_blank">dovecot-sieve-1543841568-836314-0@imap.example.com</a>>: 
discarding vacation response to auto-submitted message from 
<MAILER-DAEMON><br>
Dec  3 13:52:48 imap dovecot: lda(<a href="mailto:test@example.com" target="_blank">test@example.com</a>): sieve: 
msgid=<<a href="mailto:dovecot-sieve-1543841568-836314-0@imap.example.com" target="_blank">dovecot-sieve-1543841568-836314-0@imap.example.com</a>>: stored
 mail into mailbox 'INBOX'<br>
Dec  3 13:52:48 imap postfix/pipe[6663]: D835A300E05: 
to=<<a href="mailto:test@example.com" target="_blank">test@example.com</a>>, orig_to=<<a href="mailto:test@xyz.com" target="_blank">test@xyz.com</a>>, 
relay=dovecot, delay=0.1, delays=0.03/0.01/0/0.06, dsn=2.0.0, 
status=sent (delivered via dovecot service)</p>
<p><br>
</p>
<p>Can somebody help with this issue and/or point where to go for debugging?<br>
</p>
<p><br>
</p>
<p>Please find my dovecot configuration bellow:<br>
</p>
<p><br>
</p>
<p>
</p>
<p><br>
</p>
<p>


        
        
        
        

</p>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><pre>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"
}</pre></blockquote>


<p><br>
</p>
<p><br>
</p>
<p>dovecot-ldap.conf.ext</p>
<p><br>
</p>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">hosts =  <a href="http://example.com" target="_blank">example.com</a><br>
base = ou=People,dc=example,dc=com<br>
ldap_version = 3<br>
auth_bind = yes<br>
user_filter = (&(objectClass=posixAccount)(uid=%n))<br>
pass_filter = (&(objectClass=posixAccount)(uid=%n))<br><br>
user_attrs = \<br>
 mailRoutingAddress=user, \<br>
 =uid=vmail, \<br>
 =gid=mail, \<br>
 =home=/var/mail/%d/%n, \<br>
 =quota_rule=*:bytes=%{ldap:departmentNumber}<br><br><br>
pass_attrs= mailRoutingAddress=user<br><br>
tls = yes<br></blockquote><p>
  
  
  
  
  <br>
</p>

<p>My vacation script:</p>
<p><br>
</p>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">require ["date","relational","vacation"];<br>
# rule:[Vacation]<br>
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")<br>
{<br>
    vacation :addresses "<a href="mailto:test@example.com" target="_blank">test@example.com</a>" :subject "Away" "I'm away";<br>
}<br></blockquote><p>
  <br>
</p>
<p><br>
</p>
</div>
</blockquote></div>