Send mail from telnet

A blast from the past! Telnet is a command-line tool that allows you to connect to a remote server and interact with it as if you were sitting in front of it. While it's not the most user-friendly way to send email, you can use Telnet to send a simple email using the SMTP (Simple Mail Transfer Protocol) protocol.

Here's a step-by-step guide to send an email using Telnet:

Prerequisites:

  1. You need to know the SMTP server's hostname or IP address of the email service you want to use (e.g., Gmail, Outlook, etc.).
  2. You need to know your email address and password.

Sending an email using Telnet:

  1. Open a command prompt or terminal window.
  2. Type telnet <smtp_server_hostname> 25 (replace <smtp_server_hostname> with the hostname or IP address of the SMTP server). Press Enter.
  3. You should see a response from the SMTP server, indicating that the connection was successful. For example:
    220 mx.google.com ESMTP a15sm1041315wma.14 - gsmtp
  4. Type HELO <your_email_address> (replace <your_email_address> with your email address). Press Enter.
  5. The SMTP server will respond with a greeting message. For example:
    250-mx.google.com at your service, [your_email_address]
  6. Type MAIL FROM:<your_email_address> (replace <your_email_address> with your email address). Press Enter.
  7. Type RCPT TO:<recipient_email_address> (replace <recipient_email_address> with the email address of the recipient). Press Enter.
  8. Type DATA to start composing the email. Press Enter.
  9. Type the email subject and body, followed by a blank line to indicate the end of the email. For example:
    
    Subject: Test email from Telnet

This is a test email sent using Telnet.

10. Type `.` (dot) to indicate the end of the email. Press Enter.
11. Type `QUIT` to close the connection. Press Enter.

**Example Telnet session:**

telnet mx.google.com 25 220 mx.google.com ESMTP a15sm1041315wma.14 - gsmtp HELO [email protected] 250-mx.google.com at your service, [email protected] MAIL FROM:[email protected] 250 2.1.0 Address accepted RCPT TO:[email protected] 250 2.1.5 Address accepted DATA Subject: Test email from Telnet

This is a test email sent using Telnet.

. 250 2.0.0 Message accepted for delivery QUIT 221 2.0.0 closing connection


**Note:** This is a very basic example, and you may need to add additional headers or authentication information depending on the SMTP server and email service you're using. Additionally, keep in mind that using Telnet to send email is not recommended for production use, as it's not a secure or reliable method.