skip to navigation
skip to content

pymmails 0.2.175

A module to download emails from an IMAP4 server

Links:

Description

The module was started to grab emails using IMAP and to store them on a local disk. I now use it to download to material sent by my students before an oral presentation. I receive many of them and it is usually annoying to download them one by one. Here is the code I use:

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'

Design

This project contains various helper about logging functions, unit tests and help generation.

  • a source folder: src
  • a unit test folder: _unittests, go to this folder and run run_unittests.py
  • a _doc folder: _doc, it will contains the documentation
  • a file setup.py to build and to install the module
  • a file make_help.py to build the sphinx documentation

Versions

  • 0.3 - 2016/??/??
    • new: new design
 
File Type Py Version Uploaded on Size
pymmails-0.2.175-py3-none-any.whl (md5) Python Wheel 3.5 2016-05-15 31KB
pymmails-0.2.175.tar.gz (md5) Source 2016-05-15 22KB