Skip to content
Snippets Groups Projects
Verified Commit 01166917 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

WIP: diagnostics sendmail

parent daead5be
No related branches found
No related tags found
No related merge requests found
......@@ -123,21 +123,28 @@ def test_imports(modules):
result[m] = (False, str(e))
return result
def test_send_mail():
result = dict()
import caosdb
from caosadvancedtools.serverside import helper
test_mail_to = get_option("test-mail-to")
test_mail_from = get_option("test-mail-from")
result["sendmail_bin"] = get_option("test-sendmail-bin",
caosdb.get_config()["Misc"]["sendmail"])
caosdb.get_config()["Misc"]["sendmail"] if "Misc" in caosdb.get_config() and "sendmail" in caosdb.get_config()["Misc"] else None)
if test_mail_to is not None and test_mail_from is not None:
helper.send_mail(from_addr=test_mail_from,
to=test_mail_to,
subject="CaosDB Test Mail",
body=("This is a test mail from the diagnostics.py "
"server-side script"),
send_mail_bin=result["sendmail_bin"])
try:
helper.send_mail(from_addr=test_mail_from,
to=test_mail_to,
subject="CaosDB Test Mail",
body=("This is a test mail from the diagnostics.py "
"server-side script"),
send_mail_bin=result["sendmail_bin"])
except Exception as e:
if hasattr(e, "stderr"):
print(e.stderr, file=sys.stderr)
raise e
return result
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment