diff options
-rwxr-xr-x | jobs/JobBase.py | 4 | ||||
-rwxr-xr-x | main.py | 3 | ||||
-rwxr-xr-x | settings.cfg.example | 5 |
3 files changed, 7 insertions, 5 deletions
diff --git a/jobs/JobBase.py b/jobs/JobBase.py index e7b3c33..a10bdeb 100755 --- a/jobs/JobBase.py +++ b/jobs/JobBase.py @@ -34,11 +34,11 @@ def sendEmail(config, subject, body, to=""): FROM = config.get('email', 'user') PASS = config.get('email', 'pass') if not to: - to = config.get('alertcontact', 'default') + to = config.get('general', 'alertcontact') # Prepare actual message # Avoid gmail threading - subject = subject + " " + str(random.random()) + subject = "[" + config.get('general', 'servername') + "] " + subject + " " + str(random.random()) message = """\From: %s\nTo: %s\nSubject: %s\n\n%s""" \ % (FROM, ", ".join(to), subject, body) try: @@ -39,7 +39,8 @@ if __name__ == "__main__": not config.get('email', 'imapserver'): print "Sending email address is not configured" sys.exit(1) - if not config.get('alertcontact', 'default'): + if not config.get('general', 'servername') or \ + not config.get('general', 'alertcontact'): print "Default alert contact is not configured" sys.exit(1) diff --git a/settings.cfg.example b/settings.cfg.example index 2dd8695..02531cf 100755 --- a/settings.cfg.example +++ b/settings.cfg.example @@ -1,5 +1,6 @@ -[alertcontact]
-default=youremail@example.com
+[general]
+servername=uniqueservername
+alertcontact=youremail@example.com
[email]
user=agmailaccountyoucreate@gmail.com
|