blog-agent

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 6d02bcf72f56e9b781ea6ae7394173654f42553c
Author: dankert <devnull@localhost>
Date:   Sat, 13 Apr 2013 23:57:01 +0200

Erste Version des "Blog-Agenten". Verbindet sich per E-Mail mit dem IMAP-Server und verarbeitet die Mails aus einem bestimmten Ordner.

Diffstat:
abholer.py | 38++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+), 0 deletions(-)

diff --git a/abholer.py b/abholer.py @@ -0,0 +1,38 @@ +#!/usr/bin/python +# E-Mail-Abholer +# +# +import imaplib,email + + +M = imaplib.IMAP4("mail.jdhh.de") +M.login("blog@jandankert.de", "blogmaschine") +M.select("INBOX") +typ, data = M.search(None, 'ALL') +for num in data[0].split(): + typ, data = M.fetch(num, '(RFC822)') + print 'Message #'+num; + src = data[0][1] + msg = email.message_from_string(src) + print "Subject: "+msg["Subject"] + + + #for pl in get_flat_parts(msg): + for part in msg.walk(): + + if part.is_multipart(): + continue + + print " Typ:"+part.get_content_type() + print " Inhalt:"+part.get_payload() + #print "Filename:"+part.get_filename() + print "\n" + print "\n\n" + + M.copy(num,"Archiv") + M.store(num, '+FLAGS', r'(\Deleted)') + M.expunge +M.close() +M.logout() + +