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.
[[email protected]#### ~]$ telnet notexample.com 25 Trying 18.104.22.168... 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 [22.214.171.124]
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 [126.96.36.199] 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 188.8.131.52) Connection closed by foreign host.
The entire TELNET conversation should look like the following.
[[email protected]#### ~]$ telnet notexample.com 25 Trying 184.108.40.206... 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 [220.127.116.11] EHLO localhost 250-fox.somenameserver.com Hello localhost [18.104.22.168] 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 22.214.171.124) 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.
Thoughts on “Communicating with an email server using TELNET”
It looks like you were trying to put an image in the post. If so, the link is not correct or not working. If you have any further questions or comments, please let us know.
I think I got it going. Mail is quite strange in setting it up. The trick is that it wants to set the SMTP to 587 when the port setting is supposed to be 465 (at least that’s what it says in your information).
587 is the only port that works with your recommended SMTP settings now, though port 465 used to work just fine in the past (Sever: secure161servconfig.com, Authenciation:Password,username:<email address>, password:<your password>). If settings get screwed up enough, Mail gives it up. Thereafter, the only way out is to start over.
Get a totally different response with port 587 than that of 465 and I think you will too.
Thank you for contacting us. Since your available server ports for email have not changed, most likely the network you are connecting from, or your ISP is blocking the port. This is common with many ISP’s, or public networks.
If you have any further questions, feel free to post them below.
The problem I’m having is that while I CAN OPEN the port in Telnet, I CANNOT send via my client using SSL. I get the advice that the certificate doesn’t exist or that the certificate is expired or that the encryption is wrong (not 64 bit) depending on which client or method is being used (e.g., Mail, or direct access via another app that sends via secure server). What can be done to troubleshoot this? I tried to chat with your support (Matthew) nothing was resolved.
I’m not really sure how you’re trying to send (I’m assuming this is an outgoing email). If you have the SSL settings for outgoing email correctly configured with your email client, then it will send the email using the secure connection. Our Email over SSL article should give you the necessary information for the correct setup.
If you have any further questions or comments, please let us know.
I’m using Mac OS and the Terminal (application). What are the commands I would use to check the SMTP server port 465 with SSL?
It would be the same command just “telnet server.com 465”.
Hi, I am Trying to connect the server using windows cmd promt. just blank output I got. and nothing generated in logs aslo. I mean Request is not hitted to server. What could be the reoason ?
Thanks for the question. Just because you get a blank screen doesn’t mean it’s an error. You most likely have connected. When you telnet in, you must give a command afterward to continue working in the telnet connection. This a pretty commonly discussed issue. Check out this forum post. They explain exactly what you may be seeing.