Added unicode icons in messages
Added unicode icons in messages
This commit is contained in:
41
scripts/unix/usr/local/sbin/send-mail
Normal file
41
scripts/unix/usr/local/sbin/send-mail
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
rcpt=$1
|
||||
subj=$2
|
||||
message=$3
|
||||
|
||||
ARGS=$(xargs echo $(perl -anle 's/^[^:]+//g && s/:\s+//g && print' /etc/email.conf) < /dev/null)
|
||||
set -- $ARGS "$@";
|
||||
|
||||
declare -A email;
|
||||
email['user']=$1
|
||||
email['pass']=$2
|
||||
email['smtp']=$3
|
||||
email['port']=$4
|
||||
|
||||
email_content='From: "Watchdog" <'"${email['user']}"'>
|
||||
To: "Subscriber" <'"${rcpt}"'>
|
||||
Subject: '"${subj}"'
|
||||
Date: '"$(date)"'
|
||||
|
||||
'"${message}"'
|
||||
-----
|
||||
'"${HOSTNAME}"'
|
||||
';
|
||||
|
||||
|
||||
echo "$email_content" | curl -s \ # -vvv \
|
||||
--url "smtps://${email['smtp']}:${email['port']}" \
|
||||
--user "${email['user']}:${email['pass']}" \
|
||||
--mail-from "${email['user']}" \
|
||||
--mail-rcpt "${rcpt}" \
|
||||
--upload-file - \
|
||||
-T -
|
||||
|
||||
|
||||
if [[ $? == 0 ]]; then
|
||||
echo;
|
||||
echo 'okay';
|
||||
else
|
||||
echo "curl error code $?";
|
||||
man curl | grep "^ \+$? \+"
|
||||
fi
|
||||
Reference in New Issue
Block a user