top of page
Search
consstanransu1979

Send an email with Telnet using this simple guide



When troubleshooting email issues, it may be useful to read or send emails from your server directly using an smtp command through the telnet application. This guide shows some basic steps to send an email from your server and how to check your email using telnet.


You can use Telnet to test Simple Mail Transfer Protocol (SMTP) communication between messaging servers. SMTP is the protocol that's used to send email messages from one messaging server to another. Using Telnet can be helpful if you're having trouble sending or receiving messages because you can manually send SMTP commands to a messaging server. In return, the server will reply with responses that would be returned in a typical connection. These results can sometimes help you to figure out why you can't send or receive messages.




How to send an email with Telnet 




If you're testing a connection on a remote messaging server, you should run the steps in this topic on your Exchange server. Remote messaging servers are often set up to make sure the IP address where the SMTP connection is coming from matches the domain in the sender's email address.


When emails are failing to send from Sugar, there are a variety of potential causes. Please refer to the article Troubleshooting Outbound Email Using Sugar Logs to discover which error messages your email server is returning. If you cannot resolve the issue based on this top-level error message, you can connect to the email server via command line to see precisely what is failing. This testing method typically provides a more granular error message that can help resolve the issue.


This article will detail using telnet and OpenSSL to test your email server. These tests should preferably run from the same server that is hosting your Sugar instance, though connecting from a different server may still be useful in diagnosing the issue. Telnet and OpenSSL should be available for use on your Linux server. If your Sugar instance is hosted on a Windows server, you may need to refer to an external article for instructions to install OpenSSL such as Building a Web Server for Windows, which is written for email servers that use SMTP with TLS/SSL.


Secure connections require a different connection method with a few different parameters. TLS is typically port 465 or 587 and SSL is typically port 993, however, these ports are just defaults. Your email administrator may have changed these to non-standard ports for security reasons.


In the world of email, there are many facets to testing, but one of the most basic tests you can do is to simply telnet into a given SMTP server. This SMTP check is useful in determining if the most basic of problems do or do not exist.


The first command we need to issue to the mail server for our SMTP email tester is the EHLO or HELO. This is a basic greeting that starts the communication between the telnet client and the SMTP server. Also passed is the DNS PTR for the IP address from which we are connecting as determined previously.


Now that the MAIL FROM command has been sent we can send the RCPT TO command. This command tells the SMTP mail server to who the message should be sent. This can be the same or different than the to header, which is the email address shown in the email client.


Now that the DATA command has been sent we can start sending the message contents. This starts with the various headers. At minimum a message should contain a to, from, subject, and date header. The headers entered here will be shown to the user in their email client.


If you are troubleshooting email connectivity and email reciept issues, it may be necessary to test basic SMTP communication for the problem that you are experiencing. For example, if you have problems sending email messages over SMTP to your ESA, you can test the SMTP connectivity by using Telnet on your local client or desktop, and connect to port 25 on your ESA. By default, SMTP listens on port 25.


5xx Codes: 500 #5.5.1 command not recognized 500 Line too long 501 #5.0.0 EHLO requires domain address 501 #5.5.2 syntax error XXX 501 #5.5.4 Invalid arguments to AUTH command 501 Unknown command XXX 501 Unknown option XXX 501 Unknown value XXX 503 #5.3.3 AUTH not available 503 #5.5.0 AUTH not permitted during a mail transaction 503 #5.5.0 Already authenticated 503 #5.5.1 MAIL first 503 #5.5.1 RCPT first 503 Bad sequence of commandsDATA within mailmerge transaction 503 Bad sequence of commandsXPRT within plain transaction 503 Bad sequence of commandsnow receiving parts 503 Not in a mailmerge transaction 504 #5.5.1 AUTH mechanism XXX is not available 504 Command parameter XXX unrecognized 504 Invalid XDFN syntax 504 Invalid part number 504 Invalid part number XXX 504 No variable value specified 504 Other parts still missing 504 Reserved variable name 504 Syntax error in *parts syntax 504 XDFN command must not contain NULL characters 530 #5.7.0 Must issue a STARTTLS command first 530 #5.7.0 This sender must issue a STARTTLS command first 530 Authentication required 538 #5.7.11 Encryption required 552 #5.3.4 message header size exceeds limit 552 #5.3.4 message size exceeds limit 552 size limit exceeded 554 #5.3.0 Server Error 554 Too many hops 554 message body contains illegal bare CR/LF characters.


If you have ever needed to run a test to verify if your SMTP server can relay email, a simple way of doing so without having to load another SMTP server or run an SMTP client application is to use the TELNET command.


You can send spoofed emails (i.e., emails with a fake source address) if you can establish a telnet session with an email server. (Before continuing, go here if you need to brush up on your telnet knowledge).


You can use the command line to test your connection to the Amazon SES SMTP interface without authenticating or sending any messages. This procedure is useful for troubleshooting basic connectivity issues. If your test connection fails, see SMTP issues.


The Test-NetConnection cmdlet can determine whether your computer can connect to the Amazon SES SMTP endpoint. However, it doesn't test whether your computer can make an implicit or explicit SSL connection to the SMTP endpoint. To test an SSL connection, you can either install OpenSSL for Windows, or complete the procedure in Using the command line to send email using the Amazon SES SMTP interface to send a test email.


In the preceding command, replace email-smtp.us-west-2.amazonaws.com with the URL of the Amazon SES SMTP endpoint for your AWS Region, and replace 587 with the port number. For more information about regional endpoints in Amazon SES, see Regions and Amazon SES.


When an email sender connects to an SMTP server, the client issues a standard set of requests, and the server replies to each request with a standard response. This series of requests and responses is called an SMTP conversation. When you connect to the Amazon SES SMTP server using OpenSSL, the server expects an SMTP conversation to occur.


Note: if you connected with openssl instead of telnet, you have to make sure to type the rcpt to command in lowercase. Pressing R in the client session instructs openssl to renegotiate the TLS connection.


Knowing how to manually send an email using TELNET rather than a traditional email application such as Microsoft Outlook is sometimes useful for troubleshooting or testing for an open mail server relay. In order to send email via TELNET you will need 3 things:


Telnet uses a command prompt to access another computer or server through the syntax telnet hostname port. A user can then communicate to another computer or send commands to a server from even the most basic computer.


the SMTP protocol is ASCII based. In the past, the SMTP protocol goes unencrypted over the wire means you can simply send emails by connecting to the SMTP port 25 and enter some SMTP commands via telnet:


Let us see how to send emails using command line client like Telnet, PuTTY etc. This is very useful while troubleshooting email sending issues in Mail client like Outlook Express, MS Office Outlook etc.


Simply edit the linewith SMTP server name, port (it will default to 25 if you don't specifyit), the from email address (doesn't have to be valid, just in the format [email protected] and somethingyour mail filter will not block), to email address, subject, and messagebody as follows.


First, a telnet client has to be verified for the installation on the server. Then, you should search for a mail server to log in to. We will need the DNS MX record for a given domain to proceed with it. You can use something similar to the following command:


Note: Replace email-smtp.us-east-1.amazonaws.com with the Amazon SES SMTP endpoint that you're using. Modifying the location of the default certificate authority (CA), might cause problems when you run the preceding commands. When you install OpenSSL, make sure that you identify the location of the default CA bundle file.


Desktop clients send email over Gmail using the simple mail transfer protocol. You can use the telnet program on your computer to connect to Gmail's SMTP server and verify the connection is working properly. If a problem occurs with your local network or Internet connection, the telnet program provides an error message that you can use to troubleshoot problems connecting to Gmail.


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. 2ff7e9595c


0 views0 comments

Recent Posts

See All

Comments


bottom of page