Send email using telnet
A blast from the past! Sending an email using Telnet is a great way to understand the underlying protocol of email transmission. 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 Windows machine, you can use the built-in Telnet client. On a Mac, you can use the Terminal app.
- 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 indicating that you're connected to the mail server. Type
HELO
(orEHLO
for a more modern version) followed by your domain name or IP address. This is the initial greeting to the mail server.
HELO yourdomain.com
-
The mail server will respond with a greeting message. You'll see a line starting with
250
followed by a message. This indicates that the mail server is ready to accept your email. -
Now, you need to authenticate with the mail server. Type
AUTH
followed by the authentication method you want to use (e.g.,PLAIN
orLOGIN
). For example, if you're using Gmail, you can usePLAIN
authentication.
AUTH PLAIN
- The mail server will respond with a challenge. You'll need to provide the authentication credentials (username and password) in the format specified by the mail server. For example, if you're using Gmail, you would provide your username and password in the format
username:password
.
username:password
- Once authenticated, you can start composing your email. Type
MAIL FROM:
followed by your email address.
MAIL FROM: [email protected]
- Next, type
RCPT TO:
followed by the recipient's email address.
RCPT TO: [email protected]
- Now, you can start composing the email body. Type
DATA
to indicate the start of the email body.
DATA
- Type the email body, followed by a blank line to indicate the end of the email body.
Subject: Test email sent using Telnet
This is a test email sent using Telnet.
- To send the email, type
.
(a period) followed by a blank line.
.
-
The mail server will respond with a message indicating that the email has been sent successfully.
-
To exit the Telnet session, type
quit
and press Enter.
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 modify the commands depending on your specific email account and mail server configuration.