Skip to main content

A module to download emails from an IMAP4 server

Project description

pymmails: send and grab mails

Build status Build Status Windows GitHub Issues MIT License Requirements Status

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 = ""
pwd = "passsword"
server = "imap.your_provider.ext"

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

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'



current - 2020-11-02 - 0.00Mb

0.2.290 - 2019-01-18 - 0.03Mb

  • 3: add list of attachements at the end of the summary (2019-01-15)
  • 1: rename flake8 into code_style (2018-04-14)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Built Distribution

pymmails-0.3.319-py3-none-any.whl (32.5 kB view hashes)

Uploaded 3 7

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page