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('UID: {}'.format(msg['uid']))
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.1.tar.gz
(4.8 kB
view hashes)
Built Distribution
Close
Hashes for imap2dict-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb3fc772fec84c901fe54777ea9596c3fce550b2fb8ca13c9e669d2d57aee963 |
|
MD5 | be237e5857350285e3846c9ef96def4d |
|
BLAKE2b-256 | 2189a4a9a69016b1e8b1a084bc6c77a4ed99a2b7eee75373e2bb414e39b1c24a |