imap2dict: Receiving and deleting email on an IMAP4 server.
Project description
imap2dict
Description
imap2dict
is a Python library for receiving and deleting emails from an IMAP4 server.
Installaction
pip install imap2dict
Usage
from imap2dict import MailClient
host_name = 'mail.example.com'
user_id = 'foo'
password = 'password'
cli = MailClient(host_name, user_id, password)
# Receive email ("search_option" and "timezone" are optional.)
messages = cli.fetch_mail(search_option='UNSEEN', timezone='Asia/Tokyo')
for msg in messages:
print('Subject: {}'.format(msg['subject']))
print('Body: {}'.format(msg['body']))
print('From: {}'.format(msg['from']))
print('To: {}'.format(msg['to']))
print('Cc: {}'.format(msg['cc']))
print('Date: {}'.format(msg['date']))
print('Time: {}'.format(msg['time']))
print('Format: {}'.format(msg['format']))
print('Message-ID: {}'.format(msg['msg_id']))
print('Header: {}'.format(msg['header']))
for att in msg['attachments']:
print('File Name: {}'.format(att['file_name']))
print('File Object: {}'.format(att['file_obj']))
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
imap2dict-0.1.0.tar.gz
(4.7 kB
view hashes)
Built Distribution
Close
Hashes for imap2dict-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f487b0d17d407dae87c689270518e87d6c7f74783d51cb69f2893fc1d60249b |
|
MD5 | 5902d70fea3cc560a0b9276cf8885feb |
|
BLAKE2b-256 | 71e69de2e3f4ced31507a599a4219d09d4bb7ec8238eba9f37284f861c9a511a |