ConfigurationΒΆ

Configuration files are written in YAML. A short introduction to the YAML syntax is given in the chapter YAML Syntax. A minimal configuration file would look like this:

accounts:
    Google Mail:
        address: imap.gmail.com
        username: john.doe@gmail.com
        password: _My_PaSswOrd_
        ssl: true
        folders:
            - [INBOX, {filter: rbl, org: bl.spamcop.net, action: delete}]

logging:
    version: 1
    formatters:
        default:
            format: '%(asctime)s:%(name)-32s:%(funcName)-16s:%(levelname)-8s: %(message)s'
    handlers:
        mailfilter:
            class: logging.handlers.RotatingFileHandler
            formatter: default
            # FILENAME:
            filename: _test/log
            backupCount: 4
            maxBytes: 4194304
    loggers:
        mailfilter:
            handlers: [mailfilter]
            # LOG LEVEL:
            level: INFO

As you see there are two sections, the latter one only concerned about logging. More about that in the logging chapter.

The main section for defining IMAP accounts and what should happen with them is defined in the accounts section. The address item specifies the domain name of the IMAP server, username and password the account credentials. If SSL is to be used, an ssl item may be given with a value of true, yes or on. If it is missing, false is assumed. The folders to be examined are specified in the folders item as a list. Each item is a list consisting of a folder name and a filter specification.