You can diagnose email errors through the Linux command line using the TELNET command. You can communicate back and forth with the receiving server with TELNET to see why the email is being rejected to verify email bounce errors or to check if the server email ports are working. Below are the steps use TELNET to communicate with the server.
Important! In the code below, the Red commands are what you type and the Blue is what the server should respond back with. Also, this article is geared towards VPS and Dedicated server accounts; however, anyone can use the Linux command line on their local Linux computer. For information on shell access click here.
You can use TELNET with Windows command line; however, you will need to enable telnet on the Windows computer.
TELNET to an email server
You can communicate with a server using TELNET to find the exact error on the server in question. In this case, We will see if we can replicate the error when emails sent from [email protected] are bouncing sending to notexample.com. The basic syntax is as follows. (You can check any server port using telnet, not just port 25)
Command Domain or IP Port # telnet example.com 25
TELNET to the server that is refusing the email. In this case, the notexamplen.com server is rejecting the email.
[root@vps#### ~]$ telnet notexample.com 25 Trying 25.22.80.62... Connected to notexample.com. Escape character is '^]'. 220-fox.somenameserver.com ESMTP Exim 4.80 #2 Thu, 07 Mar 2013 08:06:11 -0600 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
Type HELO localhost to receive a response from the receiving server. This will display the server name and IP.
HELO localhost 250 fox.somenameserver.com Hello localhost [205.134.240.204]
You can also type EHLO localhost to receive more information for the receiving server. This shows the extended server response with server name IP and some supported settings.
EHLO localhost 250-fox.somenameserver.com Hello localhost [205.134.240.204] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING 250-AUTH PLAIN LOGIN 250-STARTTLS 250 HELP
Now that you verified that the server is communicating back and forth, next, ask the server to check the sending email address. Type MAIL FROM: <[email protected]> FROM: SIZE=100 ( Supplement the [email protected] with the email address you are getting bounces with) and hit enter.
MAIL FROM: <[email protected]> SIZE=100 550 Access denied - Invalid HELO name (See RFC2821 4.1.1.1) Connection closed by foreign host.
The entire TELNET conversation should look like the following.
[root@vps#### ~]$ telnet notexample.com 25 Trying 25.22.80.62... Connected to notexample.com. Escape character is '^]'. 220-fox.somenameserver.com ESMTP Exim 4.80 #2 Thu, 07 Mar 2013 08:06:11 -0600 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail. HELO localhost 250 fox.somenameserver.com Hello localhost [205.134.240.204] EHLO localhost 250-fox.somenameserver.com Hello localhost [205.134.240.204] 250-SIZE 52428800 250-8BITMIME 250-PIPELINING 250-AUTH PLAIN LOGIN 250-STARTTLS 250 HELP MAIL FROM: <[email protected]> SIZE=100 550 Access denied - Invalid HELO name (See RFC2821 4.1.1.1) Connection closed by foreign host.
The example before shows that the receiving server notexample.com is rejecting email from [email protected] with a “550 No Such User Here” error.