aerogramme/tests/instrumentation/inject_emails.sh

22 lines
385 B
Bash
Raw Normal View History

2022-07-15 14:15:48 +00:00
#!/bin/sh
2022-08-03 14:00:44 +00:00
SCRIPT=$0
USER=$1
SUBFOLDER=$2
cd $(dirname $SCRIPT)
2022-07-15 14:15:48 +00:00
function mail_lmtp_session (
echo -e "LHLO localhost\r"
2022-08-03 14:00:44 +00:00
for mail in $(find emails/$SUBFOLDER -name '*.eml' ); do
2022-07-15 14:15:48 +00:00
echo -e "MAIL FROM: <alex@adnab.me>\r"
2022-08-03 14:00:44 +00:00
echo -e "RCPT TO: $USER\r"
2022-07-15 14:15:48 +00:00
echo -e "DATA\r"
cat $mail
echo -e "\r"
echo -e ".\r"
done
echo -e "QUIT\r"
)
mail_lmtp_session | tee >(nc localhost 12024)