Files
bash_utils/mailer.sh
root 4c60127786 make local variables local
.. to not interfere with variables in the scripts that source these utils.
2025-02-03 11:12:05 +01:00

15 lines
293 B
Bash

#!/bin/bash
mailer () {
if ! [[ -z "$3" ]]; then
local mailfrom="From: $3 <christian@betz.cc>"
fi
if ! [[ -z "$4" ]]; then
local mailto="$4"
elif [[ -z "$mailto" ]]; then
local mailto="christian@betz.cc"
fi
echo -e "$1" | mailx -s "$2" --append="$mailfrom" $mailto &>/dev/null
}