Read/Send emails using Microsoft Graph API
Project description
msgraph-email
Microsoft Graph Email API using Python
Installation
msgraph-email is available on PyPI.
pip install msgraph-email
Import modules
from mail.msgraph import EmailService
from mail.models import EmailMessage,EmailAttachment
Configure a Email_Service
emailService = EmailService(tenant_id, client_id, client_secret, email_address)
Make a read email request
By default it will read unread emails of the 'Inbox' mailfolder
emailMessages= emailService.readEmails()
Make a send email request
emailMessage = EmailMessage()
emailMessage.toEmails="test@mail.com"
emailMessage.message="Hello"
emailService.sendEmail(message)
Make a read and unread email request
emailMessages = emailService.readEmails()
for email in emailMessages:
#mark it read
emailService.markEmailReadUnRead(email.messageId,isRead=True)
#mark it unread
#emailService.markEmailReadUnRead(email.messageId,isRead=False)
Make a delete email request
emailMessages = emailService.readEmails()
for email in emailMessages:
emailService.deleteEmail(email.messageId)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for msgraph_email-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b58f545c51ea20d232af0e33120dbb1e8989f316b4c874165fcc88579a15c4f8 |
|
MD5 | 69d8f90451213ff7facd7b9dd903ec7a |
|
BLAKE2b-256 | e64e0285d63d6266b445b8086e146ccc4f1db2e27acd10ed6087db88e3ec550c |