Skip to main content

Read/Send emails using Microsoft Graph API

Project description

msgraph-email

Microsoft Graph Email API using Python License PyPI - Downloads PayPal Donate

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

Uploaded Source

File details

Details for the file msgraph-email-1.1.2.tar.gz.

File metadata

  • Download URL: msgraph-email-1.1.2.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.7

File hashes

Hashes for msgraph-email-1.1.2.tar.gz
Algorithm Hash digest
SHA256 546a6e883312c1d41906a81fdf50e21884784bfce4de8e5af0b9fcb04d730b56
MD5 510bd78a4459f12e9f9152e78c8dcac1
BLAKE2b-256 f668a62a118ca2ea0dbd7191ee78cab8cd6ef171aed73de5af1d524988ec52a9

See more details on using hashes here.

Supported by

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