How to send mail using telnet
The good old days of using Telnet to send email!
To send an email using Telnet, you'll need to follow these steps:
Prerequisites:
- You have a Telnet client installed on your computer (e.g., Windows, macOS, or Linux).
- You have a working internet connection.
- You know the SMTP (Simple Mail Transfer Protocol) server address of the email service you want to use (e.g., Gmail, Outlook, or your email provider's SMTP server).
Step-by-Step Instructions:
- Open a Telnet client on your computer. You can use the built-in Telnet client on Windows (Press
Win + R
, typetelnet
, and press Enter) or use a third-party Telnet client like PuTTY on Windows or the built-intelnet
command on macOS/Linux. - Connect to the SMTP server using Telnet. Replace
<smtp_server>
with the SMTP server address of your email service:telnet <smtp_server> 25
For example, to connect to Gmail's SMTP server:
telnet smtp.gmail.com 25
- Once connected, you'll see a prompt like
220 smtp.gmail.com ESMTP
. This indicates that the SMTP server is ready to receive your email. - Start by sending the
HELO
command to introduce yourself to the SMTP server:HELO your_email_address
Replace
your_email_address
with your actual email address.
For example:
HELO [email protected]
- The SMTP server will respond with a greeting message. You'll see a line starting with
250
. - Now, send the
MAIL FROM
command to specify the sender's email address:MAIL FROM: your_email_address
Replace
your_email_address
with your actual email address.
For example:
MAIL FROM: [email protected]
- The SMTP server will respond with a message indicating that the sender's email address is valid.
- Send the
RCPT TO
command to specify the recipient's email address:RCPT TO: recipient_email_address
Replace
recipient_email_address
with the email address of the person you want to send the email to.
For example:
RCPT TO: [email protected]
- The SMTP server will respond with a message indicating that the recipient's email address is valid.
- Now, you can send the email body using the
DATA
command:DATA
This will put you in a state where you can type the email body. You can type multiple lines, and each line will be separated by a newline character (
\r\n
).
When you're done typing the email body, press Enter twice to send the email.
- The SMTP server will respond with a message indicating that the email has been received.
- To quit the Telnet session, type
QUIT
and press Enter:QUIT
That's it! You've successfully sent an email using Telnet.
Important Notes:
- This method is not recommended for sending emails regularly, as it's not a secure way to send emails. Email services like Gmail and Outlook have their own APIs and protocols for sending emails, which are more secure and efficient.
- Some email services may block or reject emails sent using Telnet due to security concerns.
- Be aware that Telnet is a plain-text protocol, so your email credentials and email body will be visible to anyone who intercepts the connection.