Added E-Mail send logic (untested yet)
This commit is contained in:
parent
7548de7609
commit
fc6c6179b8
@ -38,7 +38,7 @@
|
|||||||
<value>https://www.textbausteine.net/</value>
|
<value>https://www.textbausteine.net/</value>
|
||||||
</setting>
|
</setting>
|
||||||
<setting name="API_URL" serializeAs="String">
|
<setting name="API_URL" serializeAs="String">
|
||||||
<value>https://brecaldevel.bsmd-emswe.eu</value>
|
<value>http://127.0.0.1:5000</value>
|
||||||
</setting>
|
</setting>
|
||||||
</BreCalClient.Properties.Settings>
|
</BreCalClient.Properties.Settings>
|
||||||
</applicationSettings>
|
</applicationSettings>
|
||||||
|
|||||||
46
src/BreCalClient/Properties/Settings.Designer.cs
generated
46
src/BreCalClient/Properties/Settings.Designer.cs
generated
@ -9,20 +9,20 @@
|
|||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace BreCalClient.Properties {
|
namespace BreCalClient.Properties {
|
||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")]
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")]
|
||||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
|
|
||||||
public static Settings Default {
|
public static Settings Default {
|
||||||
get {
|
get {
|
||||||
return defaultInstance;
|
return defaultInstance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("#1D751F")]
|
[global::System.Configuration.DefaultSettingValueAttribute("#1D751F")]
|
||||||
@ -31,7 +31,7 @@ namespace BreCalClient.Properties {
|
|||||||
return ((string)(this["BG_COLOR"]));
|
return ((string)(this["BG_COLOR"]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("!!Bremen calling Testversion!!")]
|
[global::System.Configuration.DefaultSettingValueAttribute("!!Bremen calling Testversion!!")]
|
||||||
@ -40,7 +40,7 @@ namespace BreCalClient.Properties {
|
|||||||
return ((string)(this["APP_TITLE"]));
|
return ((string)(this["APP_TITLE"]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("https://www.textbausteine.net/")]
|
[global::System.Configuration.DefaultSettingValueAttribute("https://www.textbausteine.net/")]
|
||||||
@ -49,7 +49,7 @@ namespace BreCalClient.Properties {
|
|||||||
return ((string)(this["LOGO_IMAGE_URL"]));
|
return ((string)(this["LOGO_IMAGE_URL"]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||||
@ -61,16 +61,16 @@ namespace BreCalClient.Properties {
|
|||||||
this["FilterCriteria"] = value;
|
this["FilterCriteria"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("https://brecaldevel.bsmd-emswe.eu")]
|
[global::System.Configuration.DefaultSettingValueAttribute("http://127.0.0.1:5000")]
|
||||||
public string API_URL {
|
public string API_URL {
|
||||||
get {
|
get {
|
||||||
return ((string)(this["API_URL"]));
|
return ((string)(this["API_URL"]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("800")]
|
[global::System.Configuration.DefaultSettingValueAttribute("800")]
|
||||||
@ -82,7 +82,7 @@ namespace BreCalClient.Properties {
|
|||||||
this["Width"] = value;
|
this["Width"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("450")]
|
[global::System.Configuration.DefaultSettingValueAttribute("450")]
|
||||||
@ -94,7 +94,7 @@ namespace BreCalClient.Properties {
|
|||||||
this["Height"] = value;
|
this["Height"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
||||||
@ -106,7 +106,7 @@ namespace BreCalClient.Properties {
|
|||||||
this["Left"] = value;
|
this["Left"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
||||||
@ -118,7 +118,7 @@ namespace BreCalClient.Properties {
|
|||||||
this["Top"] = value;
|
this["Top"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
||||||
@ -130,7 +130,7 @@ namespace BreCalClient.Properties {
|
|||||||
this["W1Left"] = value;
|
this["W1Left"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
||||||
@ -142,7 +142,7 @@ namespace BreCalClient.Properties {
|
|||||||
this["W1Top"] = value;
|
this["W1Top"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
||||||
@ -154,7 +154,7 @@ namespace BreCalClient.Properties {
|
|||||||
this["W2Left"] = value;
|
this["W2Left"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
||||||
@ -166,7 +166,7 @@ namespace BreCalClient.Properties {
|
|||||||
this["W2Top"] = value;
|
this["W2Top"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
||||||
@ -178,7 +178,7 @@ namespace BreCalClient.Properties {
|
|||||||
this["W3Left"] = value;
|
this["W3Left"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
||||||
@ -190,7 +190,7 @@ namespace BreCalClient.Properties {
|
|||||||
this["W3Top"] = value;
|
this["W3Top"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
||||||
@ -202,7 +202,7 @@ namespace BreCalClient.Properties {
|
|||||||
this["W4Left"] = value;
|
this["W4Left"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
[global::System.Configuration.DefaultSettingValueAttribute("0")]
|
||||||
@ -214,7 +214,7 @@ namespace BreCalClient.Properties {
|
|||||||
this["W4Top"] = value;
|
this["W4Top"] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
<Value Profile="(Default)" />
|
<Value Profile="(Default)" />
|
||||||
</Setting>
|
</Setting>
|
||||||
<Setting Name="API_URL" Type="System.String" Scope="Application">
|
<Setting Name="API_URL" Type="System.String" Scope="Application">
|
||||||
<Value Profile="(Default)">https://brecaldevel.bsmd-emswe.eu</Value>
|
<Value Profile="(Default)">http://127.0.0.1:5000</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
<Setting Name="Width" Type="System.Double" Scope="User">
|
<Setting Name="Width" Type="System.Double" Scope="User">
|
||||||
<Value Profile="(Default)">800</Value>
|
<Value Profile="(Default)">800</Value>
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import logging
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import schemas.defs as defs
|
||||||
|
|
||||||
config_path = None
|
config_path = None
|
||||||
|
|
||||||
@ -13,6 +14,7 @@ def initPool(instancePath, connection_filename="connection_data_devel.json"):
|
|||||||
if(config_path == None):
|
if(config_path == None):
|
||||||
config_path = os.path.join(instancePath,f'../../../secure/{connection_filename}') #connection_data_devel.json');
|
config_path = os.path.join(instancePath,f'../../../secure/{connection_filename}') #connection_data_devel.json');
|
||||||
|
|
||||||
|
config_path = "E:/temp/connection_data.json"
|
||||||
print (config_path)
|
print (config_path)
|
||||||
|
|
||||||
if not os.path.exists(config_path):
|
if not os.path.exists(config_path):
|
||||||
@ -22,6 +24,7 @@ def initPool(instancePath, connection_filename="connection_data_devel.json"):
|
|||||||
|
|
||||||
f = open(config_path);
|
f = open(config_path);
|
||||||
connection_data = json.load(f)
|
connection_data = json.load(f)
|
||||||
|
f.close()
|
||||||
|
|
||||||
conn_from_pool = mysql.connector.connect(**connection_data)
|
conn_from_pool = mysql.connector.connect(**connection_data)
|
||||||
|
|
||||||
@ -29,6 +32,16 @@ def initPool(instancePath, connection_filename="connection_data_devel.json"):
|
|||||||
data = commands.query("SELECT id from `user`")
|
data = commands.query("SELECT id from `user`")
|
||||||
print("DB connection successful")
|
print("DB connection successful")
|
||||||
conn_from_pool.close()
|
conn_from_pool.close()
|
||||||
|
|
||||||
|
credentials_file = "email_credentials_devel.json"
|
||||||
|
credentials_path = os.path.join(instancePath,f'../../../secure/{credentials_file}')
|
||||||
|
if not os.path.exists(credentials_path):
|
||||||
|
print ('cannot find ' + os.path.abspath(credentials_path))
|
||||||
|
sys.exit(1)
|
||||||
|
f = open(credentials_path);
|
||||||
|
defs.email_credentials = json.load(f)
|
||||||
|
f.close()
|
||||||
|
|
||||||
except mysql.connector.PoolError as e:
|
except mysql.connector.PoolError as e:
|
||||||
logging.error(f"Failed to create connection pool: {e}")
|
logging.error(f"Failed to create connection pool: {e}")
|
||||||
print(e)
|
print(e)
|
||||||
|
|||||||
@ -2,4 +2,7 @@
|
|||||||
|
|
||||||
# Constants for the notification system
|
# Constants for the notification system
|
||||||
NOTIFICATION_COOLDOWN = 600 # 10 minutes until a notification gets real
|
NOTIFICATION_COOLDOWN = 600 # 10 minutes until a notification gets real
|
||||||
NOTIFICATION_MAX_AGE_DAYS = 3 # 3 days until a notification gets deleted
|
NOTIFICATION_MAX_AGE_DAYS = 3 # 3 days until a notification gets deleted
|
||||||
|
|
||||||
|
# Placeholder for the email credentials filled by startup logic
|
||||||
|
email_credentials = dict()
|
||||||
@ -1,6 +1,9 @@
|
|||||||
import logging
|
import logging
|
||||||
import pydapper
|
import pydapper
|
||||||
from BreCal.schemas import model
|
import smtplib
|
||||||
|
from email.message import EmailMessage
|
||||||
|
|
||||||
|
from BreCal.schemas import model, defs
|
||||||
from BreCal.local_db import getPoolConnection
|
from BreCal.local_db import getPoolConnection
|
||||||
from BreCal.database.update_database import evaluate_shipcall_state
|
from BreCal.database.update_database import evaluate_shipcall_state
|
||||||
from BreCal.database.sql_queries import create_sql_query_shipcall_get
|
from BreCal.database.sql_queries import create_sql_query_shipcall_get
|
||||||
@ -67,6 +70,35 @@ def UpdateNotifications():
|
|||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
logging.error(ex)
|
logging.error(ex)
|
||||||
|
|
||||||
|
def SendEmails(email_dict):
|
||||||
|
"""
|
||||||
|
This function sends emails to all users in the emaildict
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
conn = smtplib.SMTP_SSL(defs.email_credentials["server"], defs.email_credentials["port"])
|
||||||
|
conn.set_debuglevel(1)
|
||||||
|
conn.ehlo()
|
||||||
|
conn.starttls()
|
||||||
|
conn.ehlo()
|
||||||
|
conn.login(defs.email_credentials["sender"], defs.email_credentials["password_send"])
|
||||||
|
|
||||||
|
for user, message in email_dict.items():
|
||||||
|
msg = EmailMessage()
|
||||||
|
msg["Subject"] = '[Bremen calling] Notification'
|
||||||
|
msg["From"] = defs.email_credentials["sender"]
|
||||||
|
msg["To"] = user.user_email
|
||||||
|
|
||||||
|
# TODO: pretty-print and format message according to template
|
||||||
|
msg.set_content(message)
|
||||||
|
|
||||||
|
conn.sendmail(user.user_email, user.user_email, msg.as_string())
|
||||||
|
|
||||||
|
except Exception as ex:
|
||||||
|
logging.error(ex)
|
||||||
|
finally:
|
||||||
|
conn.quit()
|
||||||
|
|
||||||
|
|
||||||
def SendNotifications():
|
def SendNotifications():
|
||||||
# perhaps this will be moved somewhere else later
|
# perhaps this will be moved somewhere else later
|
||||||
try:
|
try:
|
||||||
@ -127,11 +159,10 @@ def SendNotifications():
|
|||||||
# mark as sent
|
# mark as sent
|
||||||
commands.execute("UPDATE notification SET level = 2 WHERE id = ?id?", param={"id":notification.id})
|
commands.execute("UPDATE notification SET level = 2 WHERE id = ?id?", param={"id":notification.id})
|
||||||
|
|
||||||
# send emails
|
# send emails (if any)
|
||||||
if len(email_dict) > 0:
|
if len(email_dict) > 0:
|
||||||
email_handler = EmailHandler(mail_server="smtp.gmail.com", mail_port=465, mail_address="")
|
SendEmails(email_dict)
|
||||||
for user, message in email_dict.items():
|
|
||||||
email_handler.send_email(user.user_email, "BreCal Notification", message)
|
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
logging.error(ex)
|
logging.error(ex)
|
||||||
|
|
||||||
|
|||||||
49
src/server/tests/brecal_utils/email_test.py
Normal file
49
src/server/tests/brecal_utils/email_test.py
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import os
|
||||||
|
import smtplib
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from email.message import EmailMessage
|
||||||
|
|
||||||
|
path_to_email_credentials = os.path.join(os.path.dirname(__file__), "email_credentials.json")
|
||||||
|
|
||||||
|
def send_email_example(credentials, recipient):
|
||||||
|
"""
|
||||||
|
sends an email to the given email address
|
||||||
|
:param email: the email address to send the email to
|
||||||
|
:param subject: the subject of the email
|
||||||
|
:param message: the message of the email
|
||||||
|
:return: None
|
||||||
|
"""
|
||||||
|
# create the email message
|
||||||
|
msg = EmailMessage()
|
||||||
|
|
||||||
|
|
||||||
|
msg["Subject"] = '[Bremen calling] Test Email'
|
||||||
|
msg["From"] = credentials["sender"]
|
||||||
|
|
||||||
|
conn = smtplib.SMTP(credentials["server"], credentials["port"])
|
||||||
|
conn.set_debuglevel(1)
|
||||||
|
conn.ehlo()
|
||||||
|
conn.starttls()
|
||||||
|
conn.ehlo()
|
||||||
|
conn.login(credentials["sender"], credentials["password_send"])
|
||||||
|
try:
|
||||||
|
conn.sendmail(credentials["sender"], recipient, msg.as_string())
|
||||||
|
except smtplib.SMTPException as ex:
|
||||||
|
print(f"Error: {ex}")
|
||||||
|
finally:
|
||||||
|
conn.quit()
|
||||||
|
|
||||||
|
|
||||||
|
config_path = "E:/temp/email_credentials.json"
|
||||||
|
print (config_path)
|
||||||
|
|
||||||
|
if not os.path.exists(config_path):
|
||||||
|
print ('cannot find ' + os.path.abspath(config_path))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
f = open(config_path);
|
||||||
|
credentials = json.load(f)
|
||||||
|
|
||||||
|
send_email_example(credentials, "bald@puls200.de")
|
||||||
Loading…
Reference in New Issue
Block a user