Skip to main content

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")

Metadata

Release files for py-send-m365 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-send-m365 0.3.3
File Size Uploaded Provenance Actions
py_send_m365-0.3.3.tar.gz 3.2 kB Without provenance Details for py_send_m365-0.3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for py-send-m365 0.3.3
File Interpreter ABI Platform Actions
py_send_m365-0.3.3-py3-none-any.whl Python 3 none any Details for py_send_m365-0.3.3-py3-none-any.whl

Total release size: 6.8 kB

Release files / py_send_m365-0.3.3.tar.gz

Download URL py_send_m365-0.3.3.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7aa8aab34d0d2b5efc2e61e467c83ce9dd4e2d08f246b46538e3417713cef188
BLAKE2b-256 checksum
How to use checksums
783f2165ec71891d522898a5e1d6dc6f725db136e1c28ee2b22854273e6c2645
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release files / py_send_m365-0.3.3-py3-none-any.whl

Download URL py_send_m365-0.3.3-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b6aa4f478e4dee14d60e1713274c1c5d4d884c45758557fd7beea64e6f9eb26
BLAKE2b-256 checksum
How to use checksums
8fd813cfc8e61383f4356d9c1f18fdbf774a8e8797c91a648a637025f7a730ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Security for py-send-m365 0.3.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page