Skip to content

Instantly share code, notes, and snippets.

@amityweb
Last active March 4, 2024 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amityweb/e0d1288a719e3ec2f028ec76b551cd86 to your computer and use it in GitHub Desktop.
Save amityweb/e0d1288a719e3ec2f028ec76b551cd86 to your computer and use it in GitHub Desktop.
Simple bash script to send a test email from and to someone
subject="Email Test"
body="Hello World. This is an email test and I am including this paragraph of content to gain extra points if there is a substantial body message included. Thank you."
from="$1"
to="$2"
echo -e "To: Test <$to>\nFrom: Test <$from>\nSubject: $subject\n\n$body\n" | sendmail -f $from -t $to
# USAGE #
# NOTE: Some servers may need BASH not SH
# Directly from this URL:
# curl -s https://gist.githubusercontent.com/amityweb/e0d1288a719e3ec2f028ec76b551cd86/raw/ | sh -s from@domain.com to@domain.com
# curl -s https://gist.githubusercontent.com/amityweb/e0d1288a719e3ec2f028ec76b551cd86/raw/ | bash -s from@domain.com to@domain.com
# Loal File:
# bash send-test-email-from-to.sh from@domain.com to@domain.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment