server-scripts/mail.sh

16 lines
258 B
Bash
Executable File

#!/bin/bash
MAILTO=$(cat "/root/.admin_mail")
if [ -f "/root/.host_mail" ]; then
MAILFROM=$(cat "/root/.host_mail")
fi
SUBJECT=$1
ATTACHMENT=""
if [ ! -z "$2" ]; then
ATTACHMENT="-a $2"
fi
cat | mailx -s "$SUBJECT" -r "$MAILFROM" $ATTACHMENT "$MAILTO"