Skip to main content

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


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.2.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

imap2dict-0.1.2-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file imap2dict-0.1.2.tar.gz.

File metadata

  • Download URL: imap2dict-0.1.2.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for imap2dict-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f7c9d49cb119291ee686b28d2b85e4dcf7a90da440e026900098c9797a90f0e2
MD5 0e095a064a0e5b9bfee6e37d6023fb2f
BLAKE2b-256 8fd015e0d73de93fcb797590694d1924024b778a7eb390f7bad719dae4b55230

See more details on using hashes here.

File details

Details for the file imap2dict-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: imap2dict-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for imap2dict-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 98d6b38b28ecd64abea2e03f444149ee0d7df68a856adac165ce5ae1c7f49b5a
MD5 9076c45e7e1a7d6ce5dc119abbda53a2
BLAKE2b-256 30975a0904c7cb48a4e9b5cdb3d5b6206971505c70942e1f1b285ef9b3edc11e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page