Skip to main content

email python library

Project description

maildesk

Python Library to read email from any email service. You can just dowload to yout python script folder or install it with pip. This library using Imaplib python to read email with IMAP protocol.

Usage

pip install --user maildesk
import maildesk

# imap_server = "imap-mail.outlook.com"
# imap_port = 993
# smtp_server = "smtp-mail.outlook.com"
# smtp_port = 587
# imap_server = "outlook.office365.com"
# imap_port = 993
# smtp_server = "smtp.office365.com"
# smtp_port = 587
imap_server = "imap.gmail.com"
imap_port = 993
smtp_server = "smtp.gmail.com"
smtp_port = 587
max_retry_attempts = 5

mail = maildesk.Client(imap_server,imap_port,smtp_server,smtp_port,max_retry_attempts)

Complete list of functions

Examples

send email

mail.login('emailaccount@domain.com','yourpassword')
mail.send_email('recipient@email.com','subject','message body')

select folder

mail.login('emailaccount@domain.com','yourpassword')
mail.select('Inbox')

email ID

mail.login('emailaccount@domain.com','yourpassword')
mail.select('Inbox')
date = datetime.date(1970, 1, 1)

all_ids = mail.all_ids_since(date)
unread_ids = mail.unread_ids_since(date)
read_ids = mail.read_ids_since(date)
latest_id = mail.latest_id_since(date)
latest_unread_id = mail.latest_unread_id_since(date)
latest_read_id = mail.latest_read_id_since(date)

email content

mail.login('emailaccount@domain.com','yourpassword')
mail.select('Inbox')
date = datetime.date(1970, 1, 1)
id = mail.latest_unread_id_since(date)

email_message = mail.get_email(id)
print mail.mail_body(email_message)
print mail.mail_subject(email_message)
print mail.mail_from(email_message)
print mail.mail_to(email_message)
attachments = mail.mail_attachments(email_message)
for key,value in attachments.items():
    file_name = key
    file_bytes = value

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

maildesk-0.0.3.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

maildesk-0.0.3-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file maildesk-0.0.3.tar.gz.

File metadata

  • Download URL: maildesk-0.0.3.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for maildesk-0.0.3.tar.gz
Algorithm Hash digest
SHA256 5da3a5e602285579a0a78d178fa6a1e662fa5232f2a380fe6601fcdd819fbb87
MD5 c6a9e93d9bf85be76e737a5e30b2a0af
BLAKE2b-256 c062242db226f2b9b8d955233a1cd34e029f58cc20eebc5bdea797fc4c0949fc

See more details on using hashes here.

File details

Details for the file maildesk-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: maildesk-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

File hashes

Hashes for maildesk-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3849859de863d7a1157fafe99649db17fe07ace7adb190ead928defdf47d8e60
MD5 86bd14de3235af60f78fa9d1a856b914
BLAKE2b-256 4d5218074fd8bcb37bcb6bda750a21f9a1e36d628691bfbb804a4d5a247598f4

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