Skip to main content
https://github.com/sdpython/pymmails/blob/master/_doc/sphinxdoc/source/phdoc_static/project_ico.png?raw=true

pymmails: send and grab mails

Build status Build Status Windows https://circleci.com/gh/sdpython/pymmails/tree/master.svg?style=svg https://badge.fury.io/py/pymmails.svg GitHub Issues MIT License Requirements Status https://codecov.io/github/sdpython/pymmails/coverage.svg?branch=master

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:

History

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)

Metadata

Release files for pymmails 0.3.319

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for pymmails 0.3.319
File Interpreter ABI Platform
pymmails-0.3.319-py3-none-any.whl Python 3 none any Details

Release files / pymmails-0.3.319-py3-none-any.whl

Download URL pymmails-0.3.319-py3-none-any.whl
Size 32.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cdbd294cb43e75035766825796b2e383c35fd145ac2b9edbb9083919b03c3efc
BLAKE2b-256 checksum
How to use checksums
fead54605b4b17971626ee892e8ac5be808a162bdee04e365fb47c244af8057a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.7

Release history Release notifications | RSS feed

This release

0.3.319 This release

1 release file

0.2.290

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page