[mod] Header für E-Mail-Output angepasst
This commit is contained in:
parent
d87e677008
commit
1b0a340cb3
|
|
@ -73,6 +73,7 @@ class implementation_notification_channel_email(interface_notification_channel):
|
|||
[implementation]
|
||||
'''
|
||||
def notify(self, parameters, name, data, state, info):
|
||||
datetime = _datetime.datetime.now()
|
||||
smtp_connection = _smtplib.SMTP(
|
||||
parameters["access"]["host"]
|
||||
)
|
||||
|
|
@ -101,6 +102,19 @@ class implementation_notification_channel_email(interface_notification_channel):
|
|||
)
|
||||
message["From"] = parameters["sender"]
|
||||
message["To"] = ",".join(parameters["receivers"])
|
||||
message["Date"] = string_coin(
|
||||
"{{day_of_week}}, {{day_of_month}} {{month}} {{year}} {{hour}}:{{minute}}:{{second}} {{time_offset}}",
|
||||
{
|
||||
"day_of_week": datetime.strftime("%a"),
|
||||
"day_of_month": datetime.strftime("%d"),
|
||||
"month": datetime.strftime("%b"),
|
||||
"year": datetime.strftime("%Y"),
|
||||
"hour": datetime.strftime("%H"),
|
||||
"minute": datetime.strftime("%M"),
|
||||
"second": datetime.strftime("%S"),
|
||||
"time_offset": datetime.strftime("%z"),
|
||||
}
|
||||
)
|
||||
smtp_connection.sendmail(
|
||||
parameters["sender"],
|
||||
parameters["receivers"],
|
||||
|
|
|
|||
|
|
@ -8,5 +8,6 @@ import json as _json
|
|||
import requests as _requests
|
||||
import enum as _enum
|
||||
import time as _time
|
||||
import datetime as _datetime
|
||||
import smtplib as _smtplib
|
||||
from email.mime.text import MIMEText
|
||||
|
|
|
|||
Loading…
Reference in a new issue