Showing posts with label Telnet. Show all posts
Showing posts with label Telnet. Show all posts

Thursday, December 28, 2023

Sending Email Through Telnet with Authentication

Sending an email through Telnet can be an insightful way to understand the communication between an email client and a server. This guide will take you through the process of sending an email via Telnet, including the authentication steps necessary for servers that require it.

Step 1: Connect to the Mail Server

  1. Open Command Prompt or Terminal.
  2. Connect to the email server using Telnet:
    telnet 25
    If the connection is successful, you should see a response from the SMTP server.

Step 2: Handshake with the Server

  1. Greet the mail server:
    ehlo me
    The server should respond with its capabilities. One of them should be AUTH LOGIN if it requires authentication.

Step 3: Authenticate with the Server

  1. Begin the authentication process:

    auth login

    The server will respond with 334 VXNlcm5hbWU6, prompting for your username (email address) in Base64 encoding.

  2. Send your Base64 encoded email address:

    • Convert your email address to Base64 (using a converter like this one).
    • Respond with the encoded string.
  3. Send your Base64 encoded password:

    • Convert your password to Base64 (using the same converter).
    • Respond with the encoded string.

    If successful, you should receive an "Authentication succeeded" message.

Step 4: Compose and Send the Email

  1. Set the sender email address:

    mail from:<email address you used above>
  2. Set the recipient email address:

    rcpt to:<>
  3. Start composing the message:


    After this command, you're typing the content of your email.

  4. Type the Subject and Body:

    Subject: this is a test
  5. test123 
  6. test456

To end the message, put a single period (.) on a line by itself and press Enter.

Step 5: Close the Connection

  1. Terminate the session:
    The server should confirm the termination and close the connection.

Important Notes:

  • Security Warning: Using Telnet and sending credentials in Base64 encoding is not secure. This method should only be used for testing in a secure and controlled environment.
  • Spam Filters: Many servers have strict rules to prevent spam. Emails sent this way may end up in the recipient's spam folder or be rejected entirely.
  • Legal and Ethical Considerations: Ensure you have permission to use the email server and that you're complying with all relevant laws and regulations.

This guide demonstrates how to send an email through Telnet, including the authentication step. Remember, for regular email sending, it's best to use a proper email client or script that can handle encryption and authentication to ensure secure and reliable delivery.