Hi, I’m trying to make this setup work:
-correos.maindomain.com is the name of our server (its actually an alias for the realname.maindomain.com in /etc/hosts)
-the mx of maindomain.com points to googles smpt (dig shows: maindomain.com. 21599 IN MX 0 aspmx.l.google.com.)
-the rest of the virtual servers use postfix to relay via our provider’s relayhost (relayhost = mailout.provider.com)
This is working fine for the virtual servers except our main virtual server. When some external domain sends an email to our main domain it gets received correctly in gmail. But when a local virtual server tries to send us an email to our main domain it gets:
Recipient address rejected: User unknown in local recipient table.
I’ve been searching in previous forum entries and found similar situations but still can’t sort it out .
This is our postfix/main.cf
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
compatibility_level = 2
home_mailbox = Maildir/
mailbox_command = /usr/bin/procmail
mydestination = $myhostname, localhost.$mydomain, $mydomain
myhostname = correos.maindomain.com
mynetworks_style = subnet
myorigin = $mydomain
readme_directory = no
relayhost = mailout.relayhost.com
sender_bcc_maps = hash:/etc/postfix/bcc
smtp_tls_security_level = dane
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_CAfile = /etc/postfix/postfix.ca.pem
smtpd_tls_cert_file = /etc/letsencrypt/live/correos.maindomain.com/cert.pem
smtpd_tls_key_file = /etc/letsencrypt/live/correos.maindomain.com/privkey.pem
smtpd_tls_security_level = may
virtual_alias_maps = hash:/etc/postfix/virtual
I’ve tried removing $mydomain from mydestination and even setting a blank mydestination and the the mails sent from virtual servers to our main domian works and reach our gmail account, but also every mail send to any virtual server arrives at our gmail account!
Then I found this post [Solved] Main Virtual domain with Google MX and Postfix not working with a very similar situation and the answer they found was to remove the main domain from Virtualmin according to this suggestion You’d just want to make sure to use a name like “server.domain.tld” for the server, and not put “domain.tld” under Virtualmin control. While not strictly necessary to do that, it helps keep things clean and prevent followup problems
That seems a bit risky for our production server, but if it’s really necessary we’ll try to do it. We wanted to check before going for this option.
In case it helps, our main virtual server was migrated from a Cpanel account.
Thanks in advance for any tips
Matias