Skip to content

Instantly share code, notes, and snippets.

@lrvick
Last active December 17, 2020 19:55
Show Gist options
  • Save lrvick/750e371749a00bd7342127badb3630ff to your computer and use it in GitHub Desktop.
Save lrvick/750e371749a00bd7342127badb3630ff to your computer and use it in GitHub Desktop.
TLDR guide to sending an email with telnet
  1. Connect to the hashbang mail server with telnet

    > ssh sf1.hashbang.sh telnet localhost 25
    Trying ::1...
    Connected to localhost.
    Escape character is '^]'.
    220 sf1.hashbang.sh ESMTP Postfix (Debian/GNU)
    
  2. Announce yourself to the mail sever

    ELHO hashbang.sh
    

    The server will respond with a list of protocals it supports:

    250-sf1.hashbang.sh
    250-PIPELINING
    250-SIZE 52428800
    250-VRFY
    250-ETRN
    250-STARTTLS
    250-ENHANCEDSTATUSCODES
    250-8BITMIME
    250 DSN
    
  3. Tell the server who you want to send mail as

    MAIL FROM:[email protected]
    

    Note: you can put literally any email you want here. This is like a return address on an envelope. Most email servers will blindly let you impersonate anyone. We call this email "spoofing".

  4. Tell the server who you want to receive the mail

    RCPT TO: [email protected]
    
  5. Tell the server the body of the message you want to send

    Note: end with a period on a line by itself

    DATA
    Subject: some subject
    
    My really awesome message here
    
  6. Send message

    .
    

    Just a single period on a line by itself lets the server know you are done.

    Go check your inbox!

    Depending on who you spoofed, it may or may not be in spam.

    Please don't abuse this, and be mindful of the laws in your local area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment