mailq-inspector/vagrant-util/send-test-mails.sh

29 lines
1.7 KiB
Bash
Raw Normal View History

#!/bin/bash
#
# This script is supposed to be run within a shielded* vagrant environment.
# It's job is to send a bunch of test emails, for testing purposes.
# If you really intend to run this on your own, you need to pass the flag
# --LETS-REALLY-DO-THIS-AND-SEND-MAIL to it.
#
# I don't want this script to do damage.
if [[ "$1" != "--LETS-REALLY-DO-THIS-AND-SEND-MAIL" ]]; then
echo "WORD OF WARNING"
echo
echo "DO NOT RUN THIS OUT OF A SHIELDED VAGRANT BOX!"
echo "TO PROCEED RUNNING THIS TOOL, PROVIDE THE ARGUMENT"
echo "--LETS-REALLY-DO-THIS-AND-SEND-MAIL"
exit 1;
fi
# Simulate generic emails
echo "(1) This is a very plain and simple email for testing purposes." | mail -s "First testmail" -r localsender1@example.com first-mail@example.com
echo "(2) This is a very plain and simple email for testing purposes." | mail -s "Second testmail" -r localsender2@example.com second-mail@example.com
echo "(3) This is a very plain and simple email for testing purposes." | mail -s "Third testmail" -r localsender3@example.com third-mail@example.com
echo "(4) This is a very plain and simple email for testing purposes." | mail -s "Fourth testmail" -r localsender4@example.com fourth-mail@example.com
echo "(5) This is a very plain and simple email for testing purposes." | mail -s "Fifth testmail" -r localsender5@example.com fifth-mail@example.com
2019-01-26 12:17:00 +01:00
# Simulate emails with attachments
echo "Let's try an email with an attachment" | mail -s "This email contains an attachment" -r attachments@example.com -A /vagrant/main.go files@example.com
# Simulate emails for multiple recipients
echo "I send to multiple people at once" | mail -s 'Hey all!' -r 'multirecip@example.com' one@example.com two@example.com three@example.com four@example.com five@example.com