We help IT Professionals succeed at work.

email got "Remote host said: 554 5.7.1 Relay access denied

liyy asked

I setup the Ubuntu  10.04 Server, Apache / Postfix / Dovecot / Squirrelmail, everything is ok except receiving emails from outside:

squirrelmail send emails to outside - OK

Outside (e.g. yahoo, gmail) send email to my email server  - not OK

For example, I use Yahoo send testing email to my email server, but bounce back and got following error message:

Remote host said: 554 5.7.1 <xxxxx@<mydomain>.com>: Relay access denied [RCPT_TO]

Is there any settings I need to change in Postfix or squirrelmail?
Watch Question

Dimitris IoakimoglouNetwork Administrator
have you added your own domain at the mydestination line?

IT Manager
Seems like that you need to change your main.cf file

The default that Virtualmin enters there usually is:

mydestination = {hostname.hostdomain.tld}, localhost.{hostdomain.tld} , , localhost

(On one line, no linebreak!)

Without that, Postfix does not know for which domains it is responsible, interprets mail that is supposed to go to local recipient as "relaying" (sending mail to another system), and denies that for non-authenticated users.

So if you would like to host domain test.com and subdomains test1.test.com, test2.test.com and test3.test.com this line should look like:

mydestination = test1.test.com, test2.test.com, test3.test.com, localhost.test.com, localhost, test.com


XontrosAdmin and dreik

yes, I added them on the main.cf.

thanks all, I put the domain without ".com" on it, so it bounce back and shows "Relay access denied".

but when I correct them, I use Yahoo to send a email to my email server, no bounce back, but my email server didn't get any emails !!!

I use Squirrelmail to send internal users, same problem !!!!

I dump the main.cf list as below:

#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

# TLS parameters
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = <hostname>.<mydomain>.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = <hostname>.<mydomain>.com, mail.<mydomain>.com, <mydomain>.com, localhost
relayhost =
mynetworks =,
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4
home_mailbox = Maildir/


I found that when I ssh to Ubuntu and then type mail on terminal, actually server got the emails, but it doesn't show on Squirrelmail !!!
Dimitris IoakimoglouNetwork Administrator

when you say you didn't get an email, are you sure the server never got it or is it just the client that didn't download it?

then, I see you don't have myhostname set up, which will cause most anti-spam engines to reject your emails and cause other problems too


thanks XontrosAdmin

I found that the email store on mbox on their user's home folder !!