瀏覽代碼

Initial script that does the appropriate parsing

Joe Ceresini 7 年之前
父節點
當前提交
a54354e763
共有 1 個文件被更改,包括 31 次插入0 次删除
  1. 31 0
      do-parse.py

+ 31 - 0
do-parse.py

@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+
+from mailparse import parse_maildir_inbox
+
+
+#####################################################
+## Mail parsers here
+#####################################################
+
+# AWS support cases update appropriate RightNow tickets
+def parser_aws_support_case_update(msg):
+	return True
+
+# Known garbage, simply delete
+def parser_delete(msg):
+	return True
+
+
+#####################################################
+## Mapping of incoming email subjets to parsers
+#####################################################
+
+subject_parsers = [
+	( r"\[Case ([0-9]+)\]", parser_aws_support_case_update ),
+	( r"Welcome to Amazon Web Services", parser_delete ),
+	( r"Your AWS Account is Ready", parser_delete )
+]
+
+if __name__ == "__main__":
+
+	parse_maildir_inbox('/home/incoming/Maildir',subject_parsers)