0

I've currently three domains. I want to setup (mostly) the same aliases for every domain and retrieve the mails on Thunderbird. It already works to send/receive mails for contact@domain1.com, contact@domain2.net and contact@domain3.de but now I need the some aliases.

If I send a mail from xyz@web.de to one of these alias-addresses (see below), the mail comes back with the error: Recipient address rejected: User unknown in local recipient table.

I also don't understand why /etc/aliases is still active. I don't want to use this, because it can't handle same aliases on different domains.

And I already tried to change alias_maps to virtual_alias_maps, but it has no effect.

Following aliases/mails should forward its mails to contact@domain1.com

  • test@domain1.com
  • foo@domain1.com
  • bar@domain1.com

Following aliases/mails should forward its mails to contact@domain2.net

  • test@domain2.net
  • foo@domain2.net
  • bar@domain2.net

Following aliases/mails should forward its mails to contact@domain3.de

  • test@domain3.de
  • foo@domain3.de
  • bar@domain3.de

/etc/postfix/main.cf

myhostame = domain1.com
myorigin = domain1.com
mydestination = domain1.com domain2.net domain3.de localhost localhost.localdomain
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all

alias_maps = hash:/etc/aliases proxy:pgsql:/etc/postfix/pgsql-aliases.cf
local_recipient_maps = proxy:pgsql:/etc/postfix/pgsql-boxes.cf $alias_maps
mailbox_transport = lmtp:unix:private/dovecot-lmtp

smtpd_tls_cert_file=/etc/letsencrypt/live/domain1.com/fullchain.pem
smtpd_tls_key_file=/etc/letsencrypt/live/domain1.com/privkey.pem
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_tls_security_level=may
smtpd_tls_protocols = !SSLv2, !SSLv3

PostgreSQL Table

mail=> table aliases;
          alias           |        email
--------------------------+----------------------
 test@domain1.com         | contact@domain1.com
 foo@domain1.com          | contact@domain1.com
 bar@domain1.com          | contact@domain1.com
 test@domain2.net         | contact@domain2.net
 foo@domain2.net          | contact@domain2.net
 bar@domain2.net          | contact@domain2.net
 test@domain3.de          | contact@domain3.de
 foo@domain3.de           | contact@domain3.de
 bar@domain3.de           | contact@domain3.de

/etc/postfix/pgsql-aliases.cf

user=mailreader
dbname=mail
table=aliases
select_field=alias
where_field=email
hosts=unix:/var/run/postgresql
John Doof
  • 179
  • 3
  • 10
  • I'm not a postfix admin but as a database user I suspect `select_field` should be the column that has the destination email, and the `where_field` should be the column postfix is searching. – DerfK Mar 17 '16 at 17:55
  • As I understand you are using virtual users and keep all information in pgsql? – ALex_hha Mar 17 '16 at 17:59
  • I divorced mailboxes from system accounts using dovecot’s LMTP server as delivery mechanism, as well as use postgresql to keep user records. You see a tutorial here for example: [link](https://www.digitalocean.com/community/tutorials/how-to-set-up-a-postfix-email-server-with-dovecot-dynamic-maildirs-and-lmtp) – John Doof Mar 17 '16 at 18:15
  • It's a little weird solution. I mean mix virtual users with local recipients. But anyway I think @DerfK is right. You should change select_field and where_field. 'select_field=email'/'where_field=alias' – ALex_hha Mar 17 '16 at 19:06
  • No, that's not working. E-Mail from xzy@web.de to test@domain2.net returns with error `: host domain1.com[private/dovecot-lmtp] said: 550 5.1.1 User doesn't exist: test@domain2.net (in reply to RCPT TO command)` – John Doof Mar 17 '16 at 19:20

0 Answers0