Skip to main content

A simple library to send email from an existing M365 account in Python

Project description

Send Emails via M365 from Python

This module provides a simple way to send emails via Microsoft 365. You need a valid Microsoft 365 user (email address) and password.

The send_mail method is used to send an email to any recipient. You can also pass a list of recipients here ["recipient1@example.com", "recipient2@example.com"]

The host defaults to smtp.office365.com, and the port defaults to 587, but you can specify your own in the constructor if needed.

Usage

from py_send_m365 import M365Mail

Create an instance, providing optional host and port if needed

mailer = M365Mail("myuser@domain.com", "mypassword", host="smtp.example.com", port=587)

Send an email

mailer.send_mail("recipient@domain.com", "My Subject", "The html <br><i>message</i> body")

Send as

If you have allowed sending from other addresses for your user in m365, you can pass a custom from address.

mailer.send_mail("recipient@domain.com", "My Subject", "The html <br><i>message</i> body", "my-allowed-sender@domain.com")

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

py_send_m365-0.3.3.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_send_m365-0.3.3-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file py_send_m365-0.3.3.tar.gz.

File metadata

  • Download URL: py_send_m365-0.3.3.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for py_send_m365-0.3.3.tar.gz
Algorithm Hash digest
SHA256 7aa8aab34d0d2b5efc2e61e467c83ce9dd4e2d08f246b46538e3417713cef188
MD5 a1afb54d7f6a23c4b571f1f2d0a5d349
BLAKE2b-256 783f2165ec71891d522898a5e1d6dc6f725db136e1c28ee2b22854273e6c2645

See more details on using hashes here.

File details

Details for the file py_send_m365-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: py_send_m365-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for py_send_m365-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8b6aa4f478e4dee14d60e1713274c1c5d4d884c45758557fd7beea64e6f9eb26
MD5 518d7569ed925b61af4cf8bcc03967fe
BLAKE2b-256 8fd813cfc8e61383f4356d9c1f18fdbf774a8e8797c91a648a637025f7a730ab

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