<div dir="ltr"><div class="gmail_default" style="font-size:x-small">I'm trying to build a mail server for a friend using Postfix, Dovecot and Postfixadmin, using Mariadb as the backend for user information and authentication. </div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small">I've got it *almost* working. </div><div class="gmail_default" style="font-size:x-small">(dovecot -n at the bottom because I don't think the problem is in the SQL)</div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small">I have things up to the point where mail comes in, and where you can get Thunderbird to connect to Dovecot, but delivery is looking at a different directory than IMAP: </div><div class="gmail_default" style="font-size:x-small">root@mailserver:/var/mail/vmail# find ./<br>./<br>./<a href="mailto:petro@republicofmean.com">petro@republicofmean.com</a><br>./<a href="http://petro@republicofmean.com/dovecot.index.log">petro@republicofmean.com/dovecot.index.log</a><br>./<a href="http://petro@republicofmean.com/dovecot-uidvalidity.6136d995">petro@republicofmean.com/dovecot-uidvalidity.6136d995</a><br>./<a href="http://petro@republicofmean.com/tmp">petro@republicofmean.com/tmp</a><br><...><br>./<a href="http://petro@republicofmean.com/new">petro@republicofmean.com/new</a><br>./<a href="http://petro@republicofmean.com/subscriptions">petro@republicofmean.com/subscriptions</a><br>./<a href="http://republicofmean.com">republicofmean.com</a><br>./<a href="http://republicofmean.com/petro">republicofmean.com/petro</a><br>./<a href="http://republicofmean.com/petro/tmp">republicofmean.com/petro/tmp</a><br>./<a href="http://republicofmean.com/petro/cur">republicofmean.com/petro/cur</a><br>./<a href="http://republicofmean.com/petro/new">republicofmean.com/petro/new</a><br>./<a href="http://republicofmean.com/petro/new/1630897562.Vfd00Ib40009M307139.mailserver">republicofmean.com/petro/new/1630897562.Vfd00Ib40009M307139.mailserver</a><br><....></div><div class="gmail_default" style="font-size:x-small">./<a href="http://republicofmean.com/petro/new/1630899062.Vfd00Ib40011M264001.mailserver">republicofmean.com/petro/new/1630899062.Vfd00Ib40011M264001.mailserver</a><br>./<a href="http://republicofmean.com/cer">republicofmean.com/cer</a><br>./<a href="http://republicofmean.com/cer/tmp">republicofmean.com/cer/tmp</a><br>./<a href="http://republicofmean.com/cer/cur">republicofmean.com/cer/cur</a><br>./<a href="http://republicofmean.com/cer/new">republicofmean.com/cer/new</a><br>./<a href="http://republicofmean.com/cer/new/1630900562.Vfd00Ib40013M218855.mailserver">republicofmean.com/cer/new/1630900562.Vfd00Ib40013M218855.mailserver</a><br></div><div class="gmail_default" style="font-size:x-small">./<a href="http://republicofmean.com/cer/new/1630899062.Vfd00Ib40010M259724.mailserver">republicofmean.com/cer/new/1630899062.Vfd00Ib40010M259724.mailserver</a><br></div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small">The SQL I think Dovecot is using: </div><div class="gmail_default" style="font-size:x-small">root@mailserver:/etc/dovecot# grep -i select dovecot-sql.conf.ext | grep -v "^#"<br>password_query = SELECT username as user, domain, password FROM mailbox WHERE username = '%u'<br>user_query = select  CONCAT("/var/mail/vmail/",maildir) as home, 500 as uid, 500 as gid from mailbox where username="%u"<br></div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small">Here's what  Postfix is using: </div><div class="gmail_default" style="font-size:x-small"><a href="http://mysql_virtual_alias_domain_catchall_maps.cf">mysql_virtual_alias_domain_catchall_maps.cf</a>:</div><div class="gmail_default" style="font-size:x-small">   query  = SELECT goto FROM alias,alias_domain WHERE alias_domain.alias_domain = '%d' and alias.address = CONCAT('@', alias_domain.target_domain) AND alias.active = 1 AND alias_domain.active='1'<br><a href="http://mysql_virtual_alias_domain_mailbox_maps.cf">mysql_virtual_alias_domain_mailbox_maps.cf</a>:</div><div class="gmail_default" style="font-size:x-small">   query = SELECT maildir FROM mailbox,alias_domain WHERE alias_domain.alias_domain = '%d' and mailbox.username = CONCAT('%u', '@', alias_domain.target_domain) AND mailbox.active = 1 AND alias_domain.active='1'<br><a href="http://mysql_virtual_alias_domain_maps.cf">mysql_virtual_alias_domain_maps.cf</a>:</div><div class="gmail_default" style="font-size:x-small">   query = SELECT goto FROM alias,alias_domain WHERE alias_domain.alias_domain = '%d' and alias.address = CONCAT('%u', '@', alias_domain.target_domain) AND alias.active = 1 AND alias_domain.active='1'<br><a href="http://mysql_virtual_alias_maps.cf">mysql_virtual_alias_maps.cf</a>:</div><div class="gmail_default" style="font-size:x-small">   query = SELECT goto FROM alias WHERE address='%s' AND active = '1'<br><a href="http://mysql_virtual_domains_maps.cf">mysql_virtual_domains_maps.cf</a>:</div><div class="gmail_default" style="font-size:x-small">   query          = SELECT domain FROM domain WHERE domain='%s' AND active = '1'<br><a href="http://mysql_virtual_mailbox_limit_maps.cf">mysql_virtual_mailbox_limit_maps.cf</a>:</div><div class="gmail_default" style="font-size:x-small">   query = SELECT quota FROM mailbox WHERE username='%s' AND active = '1'<br><a href="http://mysql_virtual_mailbox_maps.cf">mysql_virtual_mailbox_maps.cf</a>:</div><div class="gmail_default" style="font-size:x-small">   query           = SELECT maildir FROM mailbox WHERE username='%s' AND active = '1'<br></div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small"><br></div><div class="gmail_default" style="font-size:x-small"># dovecot -n<br># 2.3.7.2 (3c910f64b): /etc/dovecot/dovecot.conf<br># Pigeonhole version 0.5.7.2 ()<br># OS: Linux 5.4.0-81-generic x86_64 Ubuntu 20.04.3 LTS ext4<br># Hostname: <redacted><br>auth_mechanisms = plain login<br>log_path = /var/log/dovecot.log<br>login_greeting = Not your mail server<br>mail_location = maildir:/var/mail/vmail/%u/<br>mail_max_userip_connections = 50<br>mail_privileged_group = vmail<br>namespace inbox {<br>  inbox = yes<br>  location =<br>  mailbox Drafts {<br>    special_use = \Drafts<br>  }<br>  mailbox Junk {<br>    special_use = \Junk<br>  }<br>  mailbox Sent {<br>    special_use = \Sent<br>  }<br>  mailbox "Sent Messages" {<br>    special_use = \Sent<br>  }<br>  mailbox Trash {<br>    special_use = \Trash<br>  }<br>  prefix =<br>}<br>passdb {<br>  args = /etc/dovecot/dovecot-sql.conf.ext<br>  driver = sql<br>}<br>protocols = " imap lmtp pop3 submission"<br>service auth-worker {<br>  user = vmail<br>}<br>service auth {<br>  unix_listener /var/spool/postfix/private/auth {<br>    group = postfix<br>    mode = 0600<br>    user = postfix<br>  }<br>  unix_listener auth-userdb {<br>    mode = 0600<br>    user = vmail<br>  }<br>  user = dovecot<br>}<br>service imap-login {<br>  inet_listener imap {<br>    port = 143<br>  }<br>  inet_listener imaps {<br>    port = 993<br>    ssl = yes<br>  }<br>}<br>service lmtp {<br>  unix_listener lmtp {<br>    group = postfix<br>    mode = 0600<br>    user = postfix<br>  }<br>}<br>service pop3-login {<br>  inet_listener pop3 {<br>    port = 110<br>  }<br>  inet_listener pop3s {<br>    port = 995<br>    ssl = yes<br>  }<br>}<br>ssl_cert = </etc/letsencrypt/live/<redacted>/fullchain.pem<br>ssl_client_ca_dir = /etc/ssl/certs<br>ssl_dh = # hidden, use -P to show it<br>ssl_key = # hidden, use -P to show it<br>userdb {<br>  args = /etc/dovecot/dovecot-sql.conf.ext<br>  driver = <br></div><div class="gmail_default" style="font-size:x-small"><br></div></div>