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
mail = maildesk.Client(imap_server,imap_port,smtp_server,smtp_port)
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
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
maildesk-0.1.1.tar.gz
(3.3 kB
view details)
Built Distribution
File details
Details for the file maildesk-0.1.1.tar.gz
.
File metadata
- Download URL: maildesk-0.1.1.tar.gz
- Upload date:
- Size: 3.3 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a8f3ddaba5693e5bb7a5b0df409e385b7449549a506cae9b759bfa48115abec |
|
MD5 | 3d1471decee2b5812c82ebbbd20a244f |
|
BLAKE2b-256 | eab80224394ad1355b788f7158b175dbd3214e1ca4d53c06b065d7d313ee25f6 |
File details
Details for the file maildesk-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: maildesk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.2 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | b66ac3f43ab3f520ae30e71a7b4522af640631b7fe724ae958edaaf138b3ee8a |
|
MD5 | d926bf1b4c7d6be491df9f0286319a97 |
|
BLAKE2b-256 | 5e18024cc8877f79a73af66030a25ab07be63440e42a2f9934343ce1fdc8e341 |