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

29 lines
1.8 KiB
Bash
Executable File

#!/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.local first-mail@example.local
echo "(2) This is a very plain and simple email for testing purposes." | mail -s "Second testmail" -r localsender2@example.local second-mail@example.local
echo "(3) This is a very plain and simple email for testing purposes." | mail -s "Third testmail" -r localsender3@example.local third-mail@example.local
echo "(4) This is a very plain and simple email for testing purposes." | mail -s "Fourth testmail" -r localsender4@example.local fourth-mail@example.local
echo "(5) This is a very plain and simple email for testing purposes." | mail -s "Fifth testmail" -r localsender5@example.local fifth-mail@example.local
# Simulate emails with attachments
echo "Let's try an email with an attachment" | mail -s "This email contains an attachment" -r attachments@example.local -A /vagrant/main.go files@example.local
# Simulate emails for multiple recipients
echo "I send to multiple people at once" | mail -s 'Hey all!' -r 'multirecip@example.local' one@example.local two@example.local three@example.local four@example.local five@example.local