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

Posted on 2012-08-14
Last Modified: 2012-08-14

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?
Question by:liyy
    LVL 3

    Assisted Solution

    by:Dimitris Ioakimoglou
    have you added your own domain at the mydestination line?
    LVL 2

    Accepted Solution

    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,

    Author Comment

    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/


    Author Comment

    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 !!!
    LVL 3

    Expert Comment

    by:Dimitris Ioakimoglou
    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

    Author Comment

    thanks XontrosAdmin

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free book by J.Peter Bruzzese, Microsoft MVP

    Are you using Office 365? Trying to set up email signatures but you’re struggling with transport rules and connectors? Let renowned Microsoft MVP J.Peter Bruzzese show you how in this exclusive e-book on Office 365 email signatures. Better yet, it’s free!

    When it comes to providing great business solutions, IBM and Microsoft are the two top companies excelling in the art. Both launch similar products aimed at a wide audience set and have a good customer satisfaction rate. Since their products are qui…
    The Microsoft Exchange server database may become damaged or corrupted due to many reasons, such as system failure. When this happens, it is usually urgent to restore the system to a stable and working state. There are different symptoms and causes …
    In this video we show how to create a User Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Mailb…
    Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now