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 [email protected], [email protected] and [email protected] but now I need the some aliases.

If I send a mail from [email protected] 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

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

Following aliases/mails should forward its mails to contact@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
--------------------------+----------------------
 [email protected]         | [email protected]
 [email protected]          | [email protected]
 [email protected]          | [email protected]
 [email protected]         | [email protected]
 [email protected]          | [email protected]
 [email protected]          | [email protected]
 [email protected]          | [email protected]
 [email protected]           | [email protected]
 [email protected]           | [email protected]

/etc/postfix/pgsql-aliases.cf

user=mailreader
dbname=mail
table=aliases
select_field=alias
where_field=email
hosts=unix:/var/run/postgresql
5
  • 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, 2016 at 17:55
  • As I understand you are using virtual users and keep all information in pgsql?
    – ALex_hha
    Mar 17, 2016 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
    – John Doof
    Mar 17, 2016 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, 2016 at 19:06
  • No, that's not working. E-Mail from [email protected] to [email protected] returns with error <[email protected]>: host domain1.com[private/dovecot-lmtp] said: 550 5.1.1 <[email protected]> User doesn't exist: [email protected] (in reply to RCPT TO command)
    – John Doof
    Mar 17, 2016 at 19:20

0

You must log in to answer this question.

Browse other questions tagged .