From 020110eefd4722a571756ac3ff583cf71a957de7 Mon Sep 17 00:00:00 2001 From: "github@kiekerjan.isdronken.nl" Date: Thu, 29 Apr 2021 22:41:03 +0200 Subject: [PATCH] fake mail script --- tools/fake_mail | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tools/fake_mail diff --git a/tools/fake_mail b/tools/fake_mail new file mode 100644 index 00000000..0beb37ce --- /dev/null +++ b/tools/fake_mail @@ -0,0 +1,22 @@ +#!/bin/bash +# Save the command-line information passed to the function +# so that I can translate info to call sendmail +if read -t 0; then + message=`cat` +fi +script="$0" + +for arg in "$@"; do + if [ "$lastarg" == "-s" ]; then + subject="$arg" + fi + if [[ $arg =~ [[:space:]] ]]; then + arg=\"$arg\" + fi + lastarg="$arg" +done + +# send message using sendmail +echo "Subject: $subject + +$message" | sendmail -F "`hostname -f`" "$lastarg"