[chronojump-server] Adds support to email when a crash is sent.
- From: Carles Pina i Estany <carlespina src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump-server] Adds support to email when a crash is sent.
- Date: Sat, 25 Jul 2015 16:39:19 +0000 (UTC)
commit 557b547ac8c246308a414636918360b060cfc725
Author: Carles Pina i Estany <carles pina cat>
Date: Sat Jul 25 18:38:56 2015 +0200
Adds support to email when a crash is sent.
email_error_log.py | 34 ++++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/email_error_log.py b/email_error_log.py
new file mode 100644
index 0000000..8243baf
--- /dev/null
+++ b/email_error_log.py
@@ -0,0 +1,34 @@
+import ConfigParser
+import smtplib
+import string
+
+config = ConfigParser.ConfigParser()
+config.read('/etc/chronojump.conf')
+
+def send(chronojump_user):
+ d = {}
+ d['chronojump_user'] = chronojump_user
+ d['from'] = config.get("notification_emails", "from")
+ d['to'] = config.get("notification_emails", "to")
+ d['subject'] = config.get("notification_emails", "subject")
+
+ body = string.Template("""From: $from
+To: $to
+Subject: $subject
+
+Hola,
+
+Hi ha un nou error log al servidor.
+
+Referencia: $chronojump_user
+
+El Servidor
+""").substitute(d)
+
+ server = smtplib.SMTP('localhost')
+ server.sendmail(d['from'],
+ d['to'],
+ body)
+
+if __name__ == "__main__":
+ send("carles pina cat")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]