send_email_to_admin function

This commit is contained in:
myvesta 2021-04-13 18:07:03 +02:00 committed by GitHub
parent dd9c8cf1f6
commit d03d8e9537
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1098,3 +1098,19 @@ no_symlink_chmod() {
chmod "${filemode}" "${i}"
done
}
# $1 = subject
# $2 = body
send_email_to_admin() {
email=$(grep CONTACT /usr/local/vesta/data/users/admin/user.conf)
email=$(echo "$email" | cut -f 2 -d "'")
if [ -z "$email" ]; then
if [ ! -z "$NOTIFY_ADMIN_FULL_BACKUP" ]; then
email=$NOTIFY_ADMIN_FULL_BACKUP
fi
fi
if [ -z "$email" ]; then
return;
fi
echo "$2" | $SENDMAIL -s "$1" "$email" 'yes'
}