mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2025-02-24 14:51:03 +01:00
Mail improvements (#1545)
This commit is contained in:
parent
cd8bd78e5d
commit
e22f1341f5
2 changed files with 4 additions and 4 deletions
|
@ -107,7 +107,7 @@ def mail(recipient: str = None, message: str = None, subject: str = None, cert:
|
||||||
'From: {} <{}>'.format(from_name, from_address),
|
'From: {} <{}>'.format(from_name, from_address),
|
||||||
"Subject: {}".format(subject),
|
"Subject: {}".format(subject),
|
||||||
"",
|
"",
|
||||||
"{}".format(message)
|
"{}".format(message.encode('utf8'))
|
||||||
]
|
]
|
||||||
|
|
||||||
with open(cert, 'rb') as pem:
|
with open(cert, 'rb') as pem:
|
||||||
|
@ -122,7 +122,7 @@ def mail(recipient: str = None, message: str = None, subject: str = None, cert:
|
||||||
msg['From'] = '{} <{}>'.format(from_name, from_address),
|
msg['From'] = '{} <{}>'.format(from_name, from_address),
|
||||||
msg['To'] = recipient
|
msg['To'] = recipient
|
||||||
|
|
||||||
msg.set_payload(message)
|
msg.set_payload(message.encode('utf8'))
|
||||||
msg_to_send = msg.as_bytes()
|
msg_to_send = msg.as_bytes()
|
||||||
|
|
||||||
# send message via e-Mail
|
# send message via e-Mail
|
||||||
|
|
|
@ -146,9 +146,9 @@ if [ "$1" = "send" ]; then
|
||||||
/usr/bin/python3 /home/admin/XXsendNotification.py ext ${notifyExtCmd} "$2"
|
/usr/bin/python3 /home/admin/XXsendNotification.py ext ${notifyExtCmd} "$2"
|
||||||
elif [ "${notifyMethod}" = "mail" ]; then
|
elif [ "${notifyMethod}" = "mail" ]; then
|
||||||
if [ "${notifyMailEncrypt}" = "on" ]; then
|
if [ "${notifyMailEncrypt}" = "on" ]; then
|
||||||
/usr/bin/python3 /home/admin/XXsendNotification.py mail "${@:3}" --from-address "${notifyMailFromAddress}" --from-name "${notifyMailFromName}" --cert "${notifyMailToCert}" --encrypt ${notifyMailTo} "$2"
|
/usr/bin/python3 /home/admin/XXsendNotification.py mail --from-address "${notifyMailFromAddress}" --from-name "${notifyMailFromName}" --cert "${notifyMailToCert}" --encrypt ${notifyMailTo} "${@:3}" "$2"
|
||||||
else
|
else
|
||||||
/usr/bin/python3 /home/admin/XXsendNotification.py mail "${@:3}" --from-address "${notifyMailFromAddress}" --from-name "${notifyMailFromName}" "${notifyMailTo}" "$2"
|
/usr/bin/python3 /home/admin/XXsendNotification.py mail --from-address "${notifyMailFromAddress}" --from-name "${notifyMailFromName}" "${notifyMailTo}" "${@:3}" "$2"
|
||||||
fi
|
fi
|
||||||
elif [ "${notifyMethod}" = "slack" ]; then
|
elif [ "${notifyMethod}" = "slack" ]; then
|
||||||
/usr/bin/python3 /home/admin/XXsendNotification.py slack -h "$2"
|
/usr/bin/python3 /home/admin/XXsendNotification.py slack -h "$2"
|
||||||
|
|
Loading…
Add table
Reference in a new issue