André Höpner wrote:
postmap -q some.user@domain.com ldap:/etc/postfix/ldap-aliases.cf first returns: someuser
The mailbox someuser exists and i can login with this user on imap and i can deliver directly using deliver -d but on mail delivery thrue postfix dovecot is not looking for someuser. It looks for someuser@host.domain.com.
It seems that postfix or dovecot appends the hostname to the mailboxname. But i cant figure out which of both. If i change the uid to someuser@hostname.domain.com on ldap-server anything works fine. how can i fix this?
Since your ldap query is returning only 'someuser', Postfix is rewriting some.user@domain.com to 'someuser' (since it's an alias), and then adding its hostname as the @domain part. See here for more detail on that:
http://www.postfix.org/postconf.5.html#append_at_myorigin
Your ldap query needs to return the address that you want to pass to deliver. So, I'm not sure from your email what address you want deliver to be given, but I'll guess that it should return 'someuser@domain.com' instead of just 'someuser'. If you are trying to pass deliver just 'someuser' you may need to jump through some hoops in your postfix configuration... you're probably better off configuring dovecot to deal with a full email address.