Join us
@daryna_dmytriievska ă» Jun 02,2023 ă» 4 min read ă» 1019 views
Simple steps will help you to launch send email using Telnet option
Telnet or Teletype Network Protocol is a client/server application protocol. It allows users to connect with the email servers directly from the command line of their computer.Â
The primary purpose of Telnet is to establish a standardized connection between terminal-oriented devices and processes (RFC 854). However, itâs also widely used for sending emails and, in that process, testing the Simple Mail Transfer Protocol (SMTP) connection.Â
Today weâll explain how to send emails using Telnet on Windows and Linux operating systems.Â
Most versions of Windows operating systems donât have Telnet enabled by default. So, to get started, first, we need to install the Telnet client. The installation process will differ slightly depending on the Windows version youâre using. Generally, we have three main options:Â
Press the Windows key or click the Start button. Locate the Start Search box, type cmd, and hit Enter. Right-click on the Command Prompt and press Run as administrator. That way, youâll have the right to complete the installation. The next step is to dial in a specific command in the command line.
For Windows 7, Windows Server 2008 R2, Windows Server 2008, or Windows Vista, type in the following command and press Enter:Â
pkgmgr /iu:"TelnetClient"
For Windows 8 and above, type in this command and press Enter:Â
dism /online /Enable-Feature /FeatureName:TelnetClient
Wait for the installation to be completed. You should receive a confirmation message on newer versions of Windows OS.Â
Another option is to use PowerShell to install the Telnet client. However, itâs only applicable to Windows 8.1, Windows 10, Windows Server 2012 R2, or later.Â
Open the PowerShell administrator window, type the following command, and press Enter.Â
Enable-WindowsOptionalFeature -Online -FeatureName TelnetClient
Wait for the installation to be completed.Â
Finally, you can install the Telnet client from the Control Panel. To do so, find Programs (or Programs and Features) and open it. Locate Turn Windows features on or off and click on it. Youâll see a Windows Features box. Find Telnet Client and mark the checkbox. Then press OK. Wait for the installation to be completed and restart the computer to apply the changes.Â
For other installation options, refer to the Microsoft documentation.Â
The email-sending process follows the logic and order of SMTP transmission: handshake, transmission, and termination of the session. It uses SMTP commands and connects to the server through a TCP port. Check out this blog post to find more information on SMTP operation.Â
Note: Telnet isnât a secure way to send an email. It establishes an unencrypted connection, as it doesnât support SSL or TLS. This means that anyone with access to your network can hijack the transmission and access the contents of your message.Â
You canât connect to SMTP servers with authentication either, as most of them require TLS or SSL encryption before allowing LOGIN and PLAIN authentication methods (authentication without TLS is allowed only on test SMTP servers). You should use OpenSSL instead of Telnet to connect to SMTP servers with encryption. Weâll be talking about OpenSSL below.Â
To start an SMTP session, youâll need the full domain name or the IP address of the SMTP server youâre trying to connect to. For example, if we were to use Mailtrap Email Testing, weâd enter sandbox.smtp.mailtrap.io.Â
Youâll also need to identify the port, which can be 25, 587, 465, or 2525. The port number depends on the configurations of the SMTP server youâre trying to connect to. Most SMTP servers block transmissions through port 25. Port 465 is suitable when sending emails with SSL encryption, while port 587 and 2525 should be used with TLS encryption.Â
Type the command:Â
telnet sandbox.smtp.mailtrap.io 25
Note: You wonât be able to use Mailtrap Email Testing for these purposes in real life as it doesnât accept Telnet connections through port 25. The code sample above is for illustrative purposes only.Â
Youâll see the response starting with code 220 if the connection is successful. For example,Â
220 sandbox.smtp.mailtrap.io ESMTP server ready
The next step is to identify yourself to the SMTP host.Â
EHLO example.com or HELO example.com
Note: The HELO command will initiate an SMTP connection without service extensions. Therefore, corresponding ESMTP commands (such as STARTTLS, for example) wonât be supported.Â
All the supported SMTP extensions will be listed in the response. Each line will start with 250, indicating a successful connection.Â
250-sandbox.smtp.mailtrap.io
250-PIPELINING
250-SIZE 10485760
250-ETRN
250-STARTTLS
250-AUTH LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
Then you can go ahead and transfer the necessary email fields according to the SMTP specification. First, type MAIL FROM
, then RCPT TO
, and then type DATA
.
MAIL FROM: <sender@example.com>
250 2.1.0 Sender OK
RCPT TO: <recipient@example.com>
250 2.1.5 Recipient OK
DATA
354 Start mail input; end with <CRLF>.<CRLF>
From: sender@example.com
To: recipient@example.com
Subject: Telnet email
This is my first test message sent using the Telnet client on Windows
.
250 2.0.0 Ok: queued as ABC123456789
To end the session, you should type the QUIT
command. The server will respond with 221 2.0.0 Service closing transmission channel
, and the connection will be terminated.Â
A complete sample will look something like this:Â
telnet sandbox.smtp.mailtrap.io 25
220 sandbox.smtp.mailtrap.io ESMTP server ready
EHLO example.com
250-sandbox.smtp.mailtrap.io Hello
250-SIZE 37748736
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-X-ANONYMOUSTLS
250-AUTH NTLM
250-X-EXPS GSSAPI NTLM
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 XRDST
MAIL FROM: <sender@example.com>
250 2.1.0 Sender OK
RCPT TO: <recipient@example.com>
250 2.1.5 Recipient OK
DATA
354 Start mail input; end with <CRLF>.<CRLF>
From: sender@example.com
To: recipient@example.com
Subject: Telnet email
This is my first test message sent using the Telnet client on Windows
.
250 2.0.0 Ok: queued as ABC123456789
QUIT
221 2.0.0 Service closing transmission channel
Check this article to get tips to send emails with Telnet on Linux.
Join other developers and claim your FAUN account now!
Influence
Total Hits
Posts
Only registered users can post comments. Please, login or signup.