Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getmail --idle INBOX
- [retriever]
- type = SimpleIMAPSSLRetriever
- server = secureimap.t-online.de
- port = 993
- username = <username>
- password = <password>
- mailboxes = ALL
- [destination]
- type = MDA_external
- path = /usr/bin/procmail
- [options]
- # retrieve only new emails
- read_all = false
- :0 Wc:
- | /usr/bin/python3 mail_handler.py
- import sys
- import email
- full_msg = sys.stdin.read()
- msg = email.message_from_string(full_msg)
- author = msg['from']
- to = msg['to']
- subject = msg['subject']
- body = msg['body']
- date = msg['Date']
- fname = '{}.txt'.format(date)
- with open(fname, 'w') as f:
- f.write(full_msg)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement