Import document attachments from SMTP account
Project description
MgMail
Simple command line utility which will import document attachments from SMTP account into a Papermerge Project instance via REST API
It connects to IMAP account (your email account) via provided username/password/imap_server and iterates through all unread email messages.
For every unread message, if it finds a file attachment - it (mg-mail) uploads it via REST API to the papermerge service.
Installation
pip install mgmail
Usage
Create a configuration file e.g. mgmail.config.py Run::
mgmail_imp --config /path/to/config.py
Configuration file
Configuration file must have .py extention and be a valid python file, example::
imap_server = "mail.paper.net"
username = "<username>"
password = "<pass>"
api_key = "<API KEY>"
papermerge_url = "<URL>" # e.g. http://localhost:8000
Configuration Settings
imap_server
is, well, your imap server.username
andpassword
- your imap user accountapi_key
is papermerge's API key. Get your api_key as explained herepapermerge_url
- paparmerge server instance url (with scheme i.e with http:// or https:// prefix). E.g. http://localhost:8000
Configuration Logging
Logging configuration are read from mgmail.logging.yml file. Example of mgmail.logging.yml file::
version: 1
handlers:
xyzconsole:
class : logging.StreamHandler
root:
level: DEBUG
handlers: [xyzconsole]
Example above configures root log to DEBUG level. All log messages will be displayed in console.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file mgmail-1.1.0.tar.gz
.
File metadata
- Download URL: mgmail-1.1.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca08dd671857080bd2f1ed0064cb213de30f31306c2381dedbb0ce6af0c9b87c |
|
MD5 | 25699ca48615df0b5d8b192eb598052b |
|
BLAKE2b-256 | 9813177470fe4ffe30f070c7459f880b369c6bde1d70769da6a9cf99784c567b |