Test mail server for an open relay

I don’t want let spammers take control of my mail server, I have configured my mail server but I am not sure how do I test my mail server for open relay? But what is an open mail realy?

An open mail relay occurs when a mail server processes a mail message where neither the sender nor the recipient is a local user. In this example, both the sender and the recipient are outside the local domain (or rather, the local IP range, for the technically inclined). The mail server is an entirely unrelated third party to this transaction. The message really has no business passing through this server.

I can check my server for open relay using any one of the following methods.

The old way (open relay server test)

Telnet to mail.myserver.com at port 25 and issue all the following commands:
helo client.server.com
mail from: rockyjr@vsnl.com
rcpt to: vivek@nixcraft.in
$ telnet mail.myserver.com 25Output:

Trying 202.51.x.xxx...
Connected to mail.myserver.com.
Escape character is '^]'.
220 mail.myserver.com ESMTP Postfix
helo client.server.com
250 mail.myserver.com
mail from: rockyjr@vsnl.com
250 Ok
rcpt to: vivek@nixcraft.in
554 : Relay access denied

As you see access denied to send email i.e. my mail server is NOT open relay.

The new way

Another and the best way is to use this website to test an open relay.

See also:


This is an old post created by LinuxTitli but it was deleted accidentally by me 🙁 I had restored the same from Google cache 🙂

🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source & DevOps topics via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
11 comments… add one
  • arfie Jul 1, 2010 @ 3:26

    Do you want to know how to make qmail mail server become close relay?
    Because i think qmail is open relay so i often email from the spammers.
    I have configured tcp.smtp file like this:


    but i still receive spam.

    And when i follow your instruction the result is still open relay.

    Thank you for your answer.

    • Amit May 5, 2011 @ 8:31

      use following
      and run
      qmailctl cdb


  • volkswagner Jan 8, 2010 @ 22:27

    Sean, I tried to telnet relay-test.mail-abuse.org, but I did not see any automated results.

    I performed the instruction set for open relay test and got access denied.

    What should I get in response fro relay-test.mail-abuse.org?

  • fosiul Sep 16, 2008 @ 15:21

    check your IP here

    if your ip is listed here then it will be rejected by yahoo.

  • Abhishek Dey May 29, 2008 @ 5:02

    hi i m trying to build an email site….but i get a rejected mail message when i send mails to rediff and yahoo. but i succesffully sent mails to gmail server and cooltoad server(cooltoad.com).
    Please can you tell me what could be the reason??

  • cc Apr 17, 2008 @ 2:01

    yes,i agree with,i don’t want get spam email too.great it’s useful for me.

  • gofirefox Oct 27, 2006 @ 17:38

    Good information, now i know how to find out if it is open

    thanks a lot

  • 🐧 nixCraft Oct 27, 2006 @ 16:58

    It is depend upon your MTA. For example postfix use following directives:

    smtpd_recipient_restrictions =
    reject_rbl_client relays.ordb.org,
    reject_rbl_client list.dsbl.org,

    Sure you need to configure sasl authentication and maintain the list of virtual domains. Let me know your MTA name.

  • Czar Oct 27, 2006 @ 16:35

    and if one would see “250 Accepted”… how does one stop an open relay

  • 🐧 nixCraft Oct 27, 2006 @ 14:03


    Good finding.

    Appreciate your post.

  • Sean Oct 27, 2006 @ 13:40

    From your mail server, telnet to


    It will do an extensive scan of your IP and immediately report the problems


Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.