Metadata-Version: 2.2
Name: py_send_m365
Version: 0.3.2
Summary: A simple library to send email from an existing M365 account in Python
Author-email: Linus Pauls <hadoken79@protonmail.com>
License: MIT
Project-URL: Homepage, https://github.com/hadoken79/py_send_m365
Project-URL: Bug Tracker, https://github.com/hadoken79/py_send_m365/issues
Keywords: email,M365,Microsoft,SMTP,Python
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE

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


