Sending email via Web Outlook with Python

254 Views Asked by At

everyone!

I've found plenty of ways to send email via Outlook Desktop using python, if there are any solutions for sending email using web version of outlook and python?

1

There are 1 best solutions below

0
Michael Sohnen On

I recommend using the Microsoft Graph API. You will need to sign in the user using Auth0.

Here is a tutorial: https://learn.microsoft.com/en-us/graph/auth
Make sure to request the right scopes for sending emails on behalf of a user.

You also need to consider what auth-flow you want to use. There are different sign-in procedures for web-apps, single-page-apps, and native apps.

After signing in, you can call the following API: https://learn.microsoft.com/en-us/graph/api/user-sendmail?view=graph-rest-1.0&tabs=http

Before doing either of these steps, you will need to register an app on azure: https://portal.azure.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade

Summary:

  1. Register application in Azure
  2. Sign in user on Microsoft Graph with appropriate permissions (auth0 scopes)
  3. Call sendEmail Microsoft Graph API