I'm running Postfix 2.6.6 on AMI Linux. The purpose of this Postfix server is to:

1) Send mail for client computers on the network.

2) Receive external email for email addresses of various usernames and domains, and forward those emails to another external email address. For example, unknown user sends an email to info@example.com and Postfix forwards it to bob@gmail.com.

#1 is working fine. However, whenever any external user sends an email to info@example.com, Postfix gives a "relay access denied" message.

Here is the log:


Oct 15 18:53:21 mx postfix/smtpd[14196]: connect from mail-wm0-f51.google.com[]
Oct 15 18:53:21 mx postfix/smtpd[14196]: NOQUEUE: reject: RCPT from mail-wm0-f51.google.com[]: 554 5.7.1 <info@example.com>: Relay access denied; from=<externaluser@gmail.com> to=<info@example.com> proto=ESMTP helo=<mail-wm0-f51.google.com>
Oct 15 18:53:21 mx postfix/smtpd[14196]: disconnect from mail-wm0-f51.google.com[]

Here are the settings in the configuration files:

postconf -n

alias_database = hash:/etc/mail/aliases
alias_maps = hash:/etc/mail/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
debug_peer_level = 2
html_directory = no
inet_interfaces = all
inet_protocols = all
local_header_rewrite_clients = permit_inet_interfaces permit_mynetworks
local_transport = error:local delivery is disabled
mail_owner = postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
masquerade_domains = websrvcs.myowndomain.ca
milter_default_action = accept
milter_protocol = 6
mydestination = localhost
mynetworks = [::1]/128
newaliases_path = /usr/bin/newaliases.postfix
non_smtpd_milters = $smtpd_milters
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
sample_directory = /usr/share/doc/postfix-2.6.6/samples
sendmail_path = /usr/sbin/sendmail.postfix
setgid_group = postdrop
smtp_generic_maps = pgsql:/etc/postfix/pgsql-generic.cf
smtp_header_checks = regexp:/etc/postfix/smtp_header_checks
smtpd_helo_required = yes
smtpd_milters = inet:
smtpd_tls_CAfile = /etc/letsencrypt/live/mx.myowndomain.ca/chain.pem
smtpd_tls_cert_file = /etc/letsencrypt/live/mx.myowndomain.ca/cert.pem
smtpd_tls_key_file = /etc/letsencrypt/live/mx.myowndomain.ca/privkey.pem
smtpd_tls_security_level = may
unknown_local_recipient_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual


postmaster: ec2-user
root: ec2-user


hosts = pgsql.myowndomain.ca:theport
user = postfix
password = password
dbname = thedb
query = SELECT result FROM postfix.generic WHERE '%s' ~* pattern LIMIT 1;


/^Received:/ IGNORE
/^Sender:/ IGNORE


info@example.com           bob@gmail.com
...other entries

I've spent a number of hours troubleshooting and searching for answers, but it seems that all the previous posts I can find deal with situations that are slightly different than mine. Now I'm at a loss.


Your postfix does not recognize that it should accept emails for example.com for delivery, it thinks that gmail is trying to use your email server as a relay.

Have a look at http://www.postfix.org/postconf.5.html#mydestination and add the domain name example.com to it.

  • example.com is a virtual domain, is it not? The documentation states: "Do not specify the names of virtual domains - those domains are specified elsewhere." – PaulC Oct 15 '16 at 19:32
  • In case example.com is a virtual domain then check out the "Mail forwarding domains" section on the postfix.org/VIRTUAL_README.html, the problem stated there matches your requirement. – termcap Oct 15 '16 at 19:35
  • Thanks. I was missing virtual_alias_domains. There was some documentation I came across previously that seemed to indicate that Postfix could determine the alias domains from the alias maps, but perhaps I misunderstood. Adding it explicitly solved the problem. – PaulC Oct 15 '16 at 19:43
  • That is exactly what I am trying to achieve and get the same result. Though postfix.org/postconf.5.html#virtual_alias_domains says: The default value is $virtual_alias_maps so that you can keep all information about virtual alias domains in one place. – Daniel Böhmer Jan 30 at 22:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.