0

I want to configure a postfix mail server using dovecot and postfixadmin with mariadb. I have followed many turorials and forum post and i am unable to receive emails. I test the configuration by sending an email to one of my alias from an external outlook mail that i have.

In the logs i see this.

 ubuntu postfix/local[10369]: C586F7E886: to=<my-email@mydomain>, orig_to=<[email protected]>, relay=local, delay=0.08, delays=0.06/0.01/0/0.01, dsn=5.1.1, status=bounced (unknown user: "my-email")

When i test if postfix can correctly read postfixadmin from the sql, it seems to work.

root@ubuntu:~# postmap -q [email protected] mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf
[email protected]

My postfix configuration is below:

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 3.6 on
# fresh installs.
compatibility_level = 3.6



# TLS parameters
smtpd_tls_cert_file = /etc/letsencrypt/live/mail.mydomain.com/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/mail.mydomain.com/privkey.pem
smtpd_tls_security_level=may

smtp_tls_CApath=/etc/ssl/certs
smtp_tls_security_level=may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache


smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination

myhostname = mail.mydomain.com
mydomain = mydomain.com
myorigin = $mydomain

alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = localhost mydomain.com
relayhost =
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4
virtual_mailbox_domains = proxy:mysql:/etc/postfix/sql/mysql_virtual_domains_maps.cf
virtual_alias_maps = proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_catchall_maps.cf
virtual_mailbox_maps = proxy:mysql:/etc/postfix/sql/mysql_virtual_mailbox_maps.cf, proxy:mysql:/etc/postfix/sql/mysql_virtual_alias_domain_mailbox_maps.cf
smtpd_tls_auth_only = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
virtual_transport = lmtp:unix:private/dovecot-lmtp
smtpd_sasl_security_options = noanonymous

Your help will be appreciated. Thx

1 Answer 1

0

The mail domains specified in mydestination are not virtual but local domains, the user database which is checked for them is local_recipient_maps, and the transport subsequently used to deliver mail is local_transport (which is confirmed by postfix/local app name).

You seem to be expecting it'll be handled by virtual_mailbox_domains, virtual_mailbox_maps and virtual_transport, but simply the order to check in Postfix is mydestination first, virtual_domain_maps second, so if the address is found to belong to some domain in mydestination, anything else simply isn't considered.

Here's VIRTUAL_README that explains things about different address classes in Postfix.

I prefer to have all my end-user (hosted) domains to be virtual. For that, we have to set up mydestination so it doesn't include any of these domains. The default ($myhostname, localhost.$mydomain, localhost) is acceptable:

myhostname = mail.(your domain)
# mydestination = (comment out to be the default)

Also, better don't set up myorigin. Let it be your server's name, that'll easier to debug afterwards. I also prefer mydomain to be not the default ($myhostname minus first component), for it to not appear in any special messages originated by this server:

# myorigin = (comment out to be the default)
mydomain = $myhostname

This is optional.

2
  • I have modified the configuration as per your comment. After postfix restart I still have an issue. The log: Aug 2 23:39:07 ubuntu postfix/smtpd[64376]: NOQUEUE: reject: RCPT from mail-am6eur05olkn2080.outbound.protection.outlook.com[40.92.91.80]: 454 4.7.1 <myalias@mydomain>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<EUR05-AM6-obe.outbound.protection.outlook.com>
    – Hoguss
    Commented Aug 2 at 23:40
  • That means your domain is not listed in virtual_maibox_domains. Show your mysql_virtual_domains_maps.cf and mysql_virtual_mailbox_maps.cf (only hide password, leave everything else as is, even if you think is private). They are referring to some database table; you have to check your domain to be present in the relevant column of that table; I'll be able to say more concretely once I see maps themselves. Always put all of that into the question, not into comments, as well as your logs. Commented Aug 3 at 3:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .