Hello,

I have the problem with aliases. The emails did not delivery to correct email. I send email to email: to_alias@domain.com that is valid alias and email should be sent to real email folder: to@domain.com. Dovecot creating to_alias folder and deliver the emails there. Here is the email log: / did not see to@domain.com below /


Apr  5 18:54:40 www postfix/smtpd[30547]: connect from mail-40137.protonmail.ch[185.70.40.137]
Apr  5 18:54:40 www postfix/smtpd[30547]: Anonymous TLS connection established from mail-40137.protonmail.ch[185.70.40.137]: TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384
Apr  5 18:54:52 www postfix/smtpd[30547]: 85A412E19B6: client=mail-40137.protonmail.ch[185.70.40.137]
Apr  5 18:54:52 www postfix/cleanup[30556]: 85A412E19B6: message-id=<M07eijxF0PArGZ92wKYpeCndUNv5g3kSEgYljlhYwOVPxIor3AmNRxrPyNK9T8GcncG1dmxS6Lv35IfR5ompsUPEGPucNn9SjxkMxAgHzhI=@protonmail.com>
Apr  5 18:54:53 www dccifd[1856]: stat(log directory "log"): No such file or directory
Apr  5 18:54:57 www postfix/qmgr[1398]: 85A412E19B6: from=<from@protonmail.com>, size=2767, nrcpt=1 (queue active)
Apr  5 18:54:57 www postfix/smtpd[30547]: disconnect from mail-40137.protonmail.ch[185.70.40.137] ehlo=2 starttls=1 mail=1 rcpt=1 data=1 quit=1 commands=7
Apr  5 18:54:57 www dovecot: lmtp(30559): Connect from local
Apr  5 18:54:57 www dovecot: lmtp(compiz@domain.com)<30559><U8KALFFmTGJfdwAA8oMCvw>: sieve: msgid=<M07eijxF0PArGZ92wKYpeCndUNv5g3kSEgYljlhYwOVPxIor3AmNRxrPyNK9T8GcncG1dmxS6Lv35IfR5ompsUPEGPucNn9SjxkMxAgHzhI=@protonmail.com>: stored mail into mailbox 'INBOX'
Apr  5 18:54:57 www postfix/lmtp[30558]: 85A412E19B6: to=<to_alias@domain.com>, relay=mail.domain.com[private/dovecot-lmtp], delay=17, delays=17/0.01/0.01/0.01, dsn=2.0.0, status=sent (250 2.0.0 <to_alias@domain.com> U8KALFFmTGJfdwAA8oMCvw Saved)
Apr  5 18:54:57 www dovecot: lmtp(30559): Disconnect from local: Logged out (state=READY)
Apr  5 18:54:57 www postfix/qmgr[1398]: 85A412E19B6: removed

I was playing with password_query but not sure did I'm on right direction.

password_query = \
  SELECT username AS user, password, \
    '/var/spool/postmail/%d/%n' AS userdb_home, 1002 AS userdb_uid, 1001 AS userdb_gid \
  FROM mailbox WHERE username = (SELECT goto FROM alias WHERE address = '%u')

I'm using dovecot --version: 2.3.18 (9dd8408c18) and my configuration is:


# 2.3.18 (9dd8408c18): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.18 (0bc28b32)
# OS: Linux 5.17.0 x86_64 Slackware 15.0+ ext4
# Hostname: www.ixip.net
base_dir = /var/run/dovecot/
default_login_user = nobody
dict {
  driver = sql
  quota = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext
}
disable_plaintext_auth = no
lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes
mail_location = maildir:/var/spool/postmail/%d/%n/Maildir
mail_privileged_group = 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 index ihave duplicate mime foreverypart extracttext
namespace inbox {
  inbox = yes
  list = 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 =
  type = private
}
passdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
passdb {
  args = /etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
plugin {
  sieve = /var/spool/postmail/%d/%n/.dovecot.sieve
  sieve_dir = /var/spool/postmail/%d/%n/sieve/
  sieve_global_dir = /var/lib/dovecot/sieve
  sieve_global_path = /var/lib/dovecot/sieve/default.sieve
}
protocols = imap lmtp sieve sieve
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0666
    user = postfix
  }
}
service imap-login {
  inet_listener imap {
    address = 127.0.0.1
    port = 143
  }
  inet_listener imaps {
    address = 127.0.0.1
    port = 993
  }
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0600
    user = postfix
  }
  user = vmail
}
service managesieve-login {
  inet_listener sieve {
    address = 127.0.0.1
    port = 4190
  }
  service_count = 1
  vsz_limit = 64 M
}
ssl_cert = </etc/postfix/ssl/mail.stzbg.com.crt
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
userdb {
  args = uid=1002 gid=1001 home=/var/spool/postmail/%d/%n allow_all_users=yes
  driver = static
}
protocol pop3 {
  pop3_uidl_format = %08Xu%08Xv
}
protocol lmtp {
  mail_plugins = " sieve"
}
protocol lda {
  mail_plugins = " sieve"
}
protocol sieve {
  managesieve_implementation_string = Dovecot Pigeonhole
}


# grep -v '^ *\(#.*\)\?$' dovecot-sql.conf.ext
driver = mysql
connect = host=localhost dbname=postfix user=postfix password=password
default_pass_scheme = CRYPT
password_query = SELECT username AS user, password FROM mailbox WHERE username = '%u';

Kind Regards,
Chris