From 934cbe0afe1bf1838bb32250f22057572d71abfe Mon Sep 17 00:00:00 2001 From: josef Date: Tue, 8 Dec 2015 09:56:35 +0100 Subject: testing emailing --- monitor/josef_experimental.py | 16 ++++++++++------ monitor/monitor_conf.py | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'monitor') diff --git a/monitor/josef_experimental.py b/monitor/josef_experimental.py index c9a94e2..5939b82 100755 --- a/monitor/josef_experimental.py +++ b/monitor/josef_experimental.py @@ -169,20 +169,24 @@ def parse_entry(e, idx, log): -from subprocess import call +import subprocess def email(s): for addr in EMAIL_ADDR: - command = 'echo "' + s + '" | mail -s "' + EMAIL_SUBJECT + '" ' + addr - command = 'echo "message content" | mail -s "' + EMAIL_SUBJECT + '" josef@nordu.net' - os.system("bash -c '" + command + "'") - + # command = 'echo "' + s + '" | mail -s "' + EMAIL_SUBJECT + '" ' + addr + # os.system("bash -c '" + command + "'") + p = subprocess.Popen( + ["mail", "-s", '"' + EMAIL_SUBJECT + '"', addr], + stdin=subprocess.PIPE, stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + parsed = p.communicate(s) + print parsed if __name__ == '__main__': # Test email if True: - email("this is an automated test") + email("this is an automated test...") # Find let's encrypt certs diff --git a/monitor/monitor_conf.py b/monitor/monitor_conf.py index f5c5f2d..f5f7cd8 100644 --- a/monitor/monitor_conf.py +++ b/monitor/monitor_conf.py @@ -39,8 +39,8 @@ EMAIL_SUBJECT = "CT TEST" # Email addresses for error messages EMAIL_ADDR = [ -# "josef@nordu.net", -"josef.gson@gmail.com" +"josef@nordu.net", +# "josef.gson@gmail.com" ] # CT logs and associated keys -- cgit v1.1