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


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?
Who is Participating?
Sergey KolesnikConnect With a Mentor IT ManagerCommented:
Seems like that you need to change your 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 and subdomains, and this line should look like:

mydestination =,,,, localhost,
Dimitris IoakimoglouConnect With a Mentor Network AdministratorCommented:
have you added your own domain at the mydestination line?
liyyAuthor Commented:
XontrosAdmin and dreik

yes, I added them on the

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 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/

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

liyyAuthor Commented:
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 AdministratorCommented:
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
liyyAuthor Commented:
thanks XontrosAdmin

I found that the email store on mbox on their user's home folder !!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.