Telnet to send mail
A blast from the past!
Yes, you can use telnet to send an email using the Simple Mail Transfer Protocol (SMTP). Here's a step-by-step guide:
Prerequisites:
- You have a working telnet client on your system.
- You know the SMTP server's hostname or IP address and the port number (usually 25 or 587).
- You have a valid email address and password.
Sending an email using telnet:
-
Open a telnet client and connect to the SMTP server:
telnet <smtp_server> 25
Replace
<smtp_server>
with the hostname or IP address of your SMTP server. -
Once connected, you'll see a response from the server, usually something like:
220 <smtp_server> ESMTP
This indicates that the server is ready to accept commands.
-
Start by sending the
HELO
command to introduce yourself:HELO <your_email_address>
Replace
<your_email_address>
with your actual email address. -
The server will respond with a greeting, usually something like:
250 <smtp_server> Hello <your_email_address>, pleased to meet you
-
Now, set the mail from address using the
MAIL FROM
command:MAIL FROM:<your_email_address>
-
Set the recipient's email address using the
RCPT TO
command:RCPT TO:<recipient_email_address>
Replace
<recipient_email_address>
with the email address of the person you want to send the email to. -
Create the email message using the
DATA
command:DATA
This will put you in a mode where you can type the email message. When you're done, type a period (
.
) on a line by itself to indicate the end of the message. -
Send the email using the
QUIT
command:QUIT
The server will respond with a success message, and the email will be sent.
Example:
Here's an example of sending an email using telnet:
telnet smtp.example.com 25
220 smtp.example.com ESMTP
HELO [email protected]
250 smtp.example.com Hello [email protected], pleased to meet you
MAIL FROM:<[email protected]>
250 2.1.0 <[email protected]>... Sender ok
RCPT TO:<[email protected]>
250 2.1.5 <[email protected]>... Recipient ok
DATA
Subject: Test email from telnet
This is a test email sent using telnet.
.
QUIT
221 2.0.0 smtp.example.com closing connection
Keep in mind that this is a very basic example, and you may need to add additional headers, such as From
and To
, depending on your email client's requirements. Additionally, some SMTP servers may require authentication or have specific requirements for sending emails.