module grabber.mailbox_mock

Inheritance diagram of pymmails.grabber.mailbox_mock

Short summary

module pymmails.grabber.mailbox_mock

Defines a mailbox using IMAP

source on GitHub

Classes

class

truncated documentation

MailBoxMock

Define a mail box reading from file (kind of mock).

Methods

method

truncated documentation

__init__

enumerate_mails_in_folder

enumerate all mails in a folder

enumerate_search_person

enumerates all mails in folder folder from a user or sent to a user

enumerate_search_subject

enumerates all mails in folder folder with a subject verifying a regular expression

folders

returns the list of folder of the mail box

login

login (nothing to do here)

logout

logout (nothing to do here)

read_mail_from_file

extract a mail from a file

Documentation

Defines a mailbox using IMAP

source on GitHub

class pymmails.grabber.mailbox_mock.MailBoxMock(folder, pwd, fLOG=<function noLOG>)[source]

Bases: pymmails.grabber.mailboximap.MailBoxImap

Define a mail box reading from file (kind of mock).

source on GitHub

Parameters
  • folder – folder to look into

  • pwd – password, in case mails are encrypted

  • fLOG – logging function

For gmail, it is imap.gmail.com and ssl must be true

source on GitHub

__init__(folder, pwd, fLOG=<function noLOG>)[source]
Parameters
  • folder – folder to look into

  • pwd – password, in case mails are encrypted

  • fLOG – logging function

For gmail, it is imap.gmail.com and ssl must be true

source on GitHub

enumerate_mails_in_folder(folder, skip_function=None, pattern='ALL')[source]

enumerate all mails in a folder

Parameters
  • folder – folder

  • skip_function – to skip mail or None to keep them all

  • pattern'ALL' by default, unused otherwise

Returns

enumerator on mails

source on GitHub

enumerate_search_person(person, folder, skip_function=None, date=None, max_dest=5, body=True)[source]

enumerates all mails in folder folder from a user or sent to a user

Parameters
  • person – person to look for

  • folder – folder name

  • skip_function – if not None, use this function on the header/body to avoid loading the entire message (and skip it)

  • pattern – search pattern (see below)

  • max_dest – maximum number of receivers

  • body – also extract the body

Returns

iterator on (message)

source on GitHub

enumerate_search_subject(subject, folder, skip_function=None, date=None, max_dest=5)[source]

enumerates all mails in folder folder with a subject verifying a regular expression

Parameters
  • subject – subject to look for

  • folder – folder name

  • skip_function – if not None, use this function on the header/body to avoid loading the entire message (and skip it)

  • pattern – search pattern (see below)

  • max_dest – maximum number of receivers

Returns

iterator on (message)

source on GitHub

folders()[source]

returns the list of folder of the mail box

source on GitHub

login(nothing to do here)[source]

source on GitHub

logout(nothing to do here)[source]

source on GitHub

read_mail_from_file(filename)[source]

extract a mail from a file

Parameters

filename – filename

Returns

MailMessage

source on GitHub