sdpython / pymmails

Read, send emails in python

Home Page:http://www.xavierdupre.fr/app/pymmails/helpsphinx/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

image

pymmails: send and grab mails

html

Build status

Build Status Windows

image

image

GitHub Issues

MIT License

image

The module was started to grab emails using IMAP and to store them on a local disk. It is now used to download material sent by students before an oral presentation, which is quite annoying to do manually.

from pymmails import MailBoxImap, EmailMessageRenderer

user = "your.email"
pwd = "passsword"
server = "imap.your_provider.ext"

box = MailBoxImap(user, pwd, server)
render = EmailMessageRenderer()
box.login()
for mail in box.enumerate_mails_in_folder("saved", pattern="<pattern>") :
    mail.dump(render, location=temp, fLOG=fLOG)
box.logout()
render.flush()

Some examples of patterns:

pattern='FROM "xavier" SINCE 1-Feb-2013'
pattern='FROM "xavier" SINCE 1-Feb-2013 BEFORE 5-May-2013'
pattern='FROM "xavier" SINCE 1-Feb-2013 BEFORE 5-May-2013 UNANSWERED'
pattern='CC "jacques" FROM "xavier" DELETED'
pattern='TEXT "github"'
pattern='LARGER 10000 SMALLER 1000000'
pattern='SUBJECT "programmation"'
pattern='TO "student" FLAGGED'
pattern='UNSEEN'

Links:

About

Read, send emails in python

http://www.xavierdupre.fr/app/pymmails/helpsphinx/index.html

License:MIT License


Languages

Language:Python 96.7%Language:Jupyter Notebook 3.0%Language:Batchfile 0.3%