What is telnet ?
Telnet is a network terminal protocol means you can user telnet protocol for accessing a remote terminal. Remote server require a TELNET server has to be installer.
TELNET also can be use for accessing remote terminals for protocols, like if a SMTP or HTTP server is installed you can access their terminal using telnet on their specific ports.
Here we will access remote terminal of SMTP server and will use SMTP commands for checking the mail functionality.
Sending a test mail from SMTP command
Connect your SMTP server using telnet
telnet <host> <port>
telnet technet.sector19.net 25
You should receive a reply like in Microsoft SMTP server
220 ServerName Microsoft ESMTP MAIL Service, Version: 7.5.7600.16385 ready at Mon, 16 Jun 2014 22:25:46 +0530
Now you have to send helo to your SMTP server and let him know from where you are sending this email
you will get reply like this
250 Staging-PC Hello [192.168.0.80]
Define your sender name
MAIL FROM: email@example.com
You should get ans like this
250 2.1.0 firstname.lastname@example.org ….Sender OK
Now give the recipients address:
RCPT TO: email@example.com
You will get ans like this
250 2.1.5 firstname.lastname@example.org
Start writing your content.
354 Start mail input; end with <CRLF>.<CRLF>
Subject: Test email from zoladius
<your content here>
250 2.6.0 <SERVER-Nameq8eNFHOZT00000005@Server-Name> Queued mail for delivery
Write your content and complete your message with period sign “.”
Close the connection
221 2.0.0 Staging-PC Service closing transmission channel
Connection to host lost.
Take a quick look at command table
|Telnet SMTP Commands|
|HELO <HOSTNAME>||Initiate SMTP Communication with Server|
|EHLO <HOSTNAME>||Same as HELO but for the ESMTP server|
|MAIL FROM: <sender email id>||Sender email id|
|RCPT To: <recipent email id>||Recipient email id|
|DATA||Initiate writing your content|
|Subject: <email subject>||Email subject name|
|Cc: <CC user email >||CC email id|
|Reply-To: <Reply email address>||Replay to email id|
||Verify username from recipent SMTP server|
|QUIT||Quit SMTP conversation with server|