Send email via telnet
A blast from the past! Sending an email via Telnet is a great way to understand the underlying protocol and can be a fun exercise. Here's a step-by-step guide to help you send an email using Telnet:
Prerequisites:
- You have a Telnet client installed on your computer. If you're using a Mac, you can use the built-in
telnet
command in the Terminal app. On Windows, you can download a Telnet client like PuTTY. - You have a working email account with a mail server that allows Telnet connections.
Step-by-Step Instructions:
- Open your Telnet client and connect to the mail server's SMTP port (usually port 25). For example, if your email account is with Gmail, you would connect to
smtp.gmail.com
on port 25.
telnet smtp.gmail.com 25
- Once connected, you'll see a prompt like
220 smtp.gmail.com ESMTP
. This is the mail server's response to your connection. - To send an email, you need to issue the
HELO
command to introduce yourself to the mail server. TypeHELO your_email_address
(replaceyour_email_address
with your actual email address).
HELO your_email_address
- The mail server will respond with a
250
code, indicating that the HELO command was successful. - Next, you need to issue the
MAIL FROM
command to specify the sender's email address. TypeMAIL FROM: your_email_address
(again, replaceyour_email_address
with your actual email address).
MAIL FROM: your_email_address
- The mail server will respond with a
250
code again. - Now, you need to issue the
RCPT TO
command to specify the recipient's email address. TypeRCPT TO: recipient_email_address
(replacerecipient_email_address
with the email address you want to send the email to).
RCPT TO: recipient_email_address
- The mail server will respond with a
250
code once more. - To send the email, you need to issue the
DATA
command. TypeDATA
to start composing the email.
DATA
- Type the email message, followed by a blank line to indicate the end of the message. For example:
`Subject: Test email from Telnet
This is a test email sent using Telnet.`
- Once you've finished typing the email, press Enter twice to send the message.
- The mail server will respond with a
250
code, indicating that the email was successfully sent. - To quit the Telnet session, type
QUIT
and press Enter.
QUIT
That's it! You've successfully sent an email using Telnet. Keep in mind that this is a basic example, and you may need to add additional headers or formatting to your email message depending on your specific requirements.