Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 818
  • Last Modified:

Postfix can't send mails from outside to my server - relay access denied

I can't send mail from an external mail to my postfix mails..

Oct 16 15:44:17 mail postfix/smtpd[18600]: connect from externaldomain.com[195.62.28.xxx]
Oct 16 15:44:17 mail postfix/smtpd[18600]: NOQUEUE: reject: RCPT from externaldomain.com[195.62.28.xxx]: 554 <localuser@localdomain.com>: Relay access denied; from=<user@externaldomain.com> to=<localuser@localdomain.com> proto=ESMTP helo=<server.externaldomain.com>
Oct 16 15:44:17 mail postfix/smtpd[18600]: disconnect from externaldomain.com[195.62.28.xxx]

here's my postconf
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
config_directory = /etc/postfix
home_mailbox = Maildir/
inet_interfaces = all
inet_protocols = all
mailbox_size_limit = 0
mydestination = mail.localdomain.com, localhost.localdomain.com, localhost
myhostname = mail.localdomain.com
mynetworks =
recipient_delimiter = +
relayhost =
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_recipient_restrictions = permit_sasl_authenticated, reject_unauth_pipelining, permit_mynetworks, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain =
virtual_alias_maps = hash:/etc/postfix/virtual

I'm using virtualmin to setup the mail accounts..
I can send mail for gmail for example and for the server email accounts.. but outside I cant send mails for my server email accounts..!
  • 2
1 Solution
mydestination = mail.localdomain.com, localhost.localdomain.com, localhost
mydestination = mail.localdomain.com, localhost.localdomain.com, localhost,localdomain.com

of course localdomain.com would be whatever your domain is set to.

postfix needs to know which domain it is authoritative for.  the way you currently have it setup you'll only receive email for the following types of addresses
efegueAuthor Commented:
well, already found the solution. It was kinda like that..
In this case it was the virtual_alias_domains variable that was missing..

Although I want this to be automatic, do u know how can I have it to make automatic checks for the existing domains in the server?
sorry, never used virtual domains yet.  but you'd have to write a script I'm sure to update the config and reload postfix.  

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now