server-scripts/mail.sh

16 lines
258 B
Bash
Raw Normal View History

2020-02-02 06:47:47 +01:00
#!/bin/bash
2022-06-05 11:20:56 +02:00
MAILTO=$(cat "/root/.admin_mail")
2020-02-05 01:18:44 +01:00
2022-06-05 11:20:56 +02:00
if [ -f "/root/.host_mail" ]; then
MAILFROM=$(cat "/root/.host_mail")
2020-02-05 01:18:44 +01:00
fi
2020-02-02 06:47:47 +01:00
SUBJECT=$1
ATTACHMENT=""
if [ ! -z "$2" ]; then
ATTACHMENT="-a $2"
fi
cat | mailx -s "$SUBJECT" -r "$MAILFROM" $ATTACHMENT "$MAILTO"