Skip to content

Instantly share code, notes, and snippets.

@pl12133
Created September 5, 2019 16:25
Show Gist options
  • Save pl12133/ed3be8538dc0bbbc8b24bceaa6efdf31 to your computer and use it in GitHub Desktop.
Save pl12133/ed3be8538dc0bbbc8b24bceaa6efdf31 to your computer and use it in GitHub Desktop.
Send an EML file through raw SMTP using Netcat
#####
# File: send-eml.sh
# Author: pl12133
# Description: Send an eml file through an SMTP service using netcat
# Usage: ./send-eml.sh [file] [smtp-server]
#####
set -e
# like `cat`, but it waits for a reply.
function slowcat(){ cat "$@" | while read; do sleep 0.5; echo "$REPLY"; done; }
# $1 = filename of .eml file to send
# $2 = SMTP server to direct the message to
slowcat <(echo "HELO $2") "$1" <(echo "QUIT") | nc "$2" 25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment