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 an Email Service
emailService = EmailService(tenant_id, client_id, client_secret, email_address)
Process to read an email request
By default it will read unread emails of the 'Inbox' mailfolder
emailMessages= emailService.readEmails()
Process to send an email request
emailMessage = EmailMessage()
emailMessage.toEmails="test@mail.com"
emailMessage.message="Hello"
emailService.sendEmail(message)
Process to read and unread an 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 Distribution
msgraph-email-1.1.1.tar.gz
(9.0 kB
view hashes)
Built Distribution
Close
Hashes for msgraph_email-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4b4b8778160b443244ff08244dfc100f539d3be72bc366ba5ff3385c58571fd |
|
MD5 | a0118dc5349779c230545de499e323c0 |
|
BLAKE2b-256 | f31ee2168b70b0e6baf470211166b423f23316eb3dac284f2a004748518da0bd |