mirror of
https://github.com/rootzoll/raspiblitz.git
synced 2024-11-20 02:09:15 +01:00
Mail improvements (#1545)
This commit is contained in:
parent
a9a5d9bb8e
commit
a7acd780fd
@ -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…
Reference in New Issue
Block a user