12345678910111213141516171819202122232425262728293031 |
- #!/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)
|