Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support Microsoft Graph API for emails #1628

Merged
merged 7 commits into from
Jan 28, 2025

Conversation

sbliven
Copy link
Member

@sbliven sbliven commented Jan 17, 2025

Motivation

This adds support for Microsoft Graph API for sending emails. This is an alternative to SMTP for MS365 accounts that would otherwise require interactive OAuth logins, making it useful for automated emails.

Description

To use this you (or your azure admin) will need to generate a tenantId, clientId, and clientSecret with permissions to send email. The process is described here.

Email configuration is done with the following variables:

General settings:

EMAIL_TYPE: [string] Optional The type of your email provider. Values "smtp" or "ms365". Defaults to "smtp".

EMAIL_FROM [string] Optional Email address that emails should be sent from.

For SMTP emails:

SMTP_HOST [string] Optional Host of SMTP server.

SMTP_PORT [number] Optional Port of SMTP server. Defaults to 587.

SMTP_SECURE [boolean] Optional Use encrypted SMTPS. Defaults to "no".

The SMTP_MESSAGE_FROM field is still available as an alias for EMAIL_FROM for backwards compatibility.

For Microsoft 365 emails using the Graph API:

MS365_TENANT_ID` [string] Optional Tenant ID for sending emails over Microsoft Graph API.

MS365_CLIENT_ID` [string] Optional Client ID for sending emails over Microsoft Graph API.

MS365_CLIENT_SECRET` [string] Optional Client Secret for sending emails over Microsoft Graph API.

Note that the default is to use SMTP, so this is fully backwards compatible with existing configuration files.

Fixes

Changes:

  • Support emails via Microsoft Graph API.

Tests included

Emails are difficult to test without using an actual email address. I have tested this manually using my own address, but I haven't included any unit tests.

  • Included for each change/fix?
  • Passing?

Documentation

  • swagger documentation updated (required for API changes)
  • official documentation updated

official documentation info

@sbliven sbliven self-assigned this Jan 17, 2025
@sbliven sbliven requested a review from despadam January 17, 2025 10:28
@sbliven sbliven added the feature New feature label Jan 17, 2025
@sbliven sbliven changed the title feat: Support Microsoft Graph API for emails feat: support Microsoft Graph API for emails Jan 17, 2025
@sbliven sbliven enabled auto-merge (squash) January 27, 2025 16:02
@sbliven sbliven disabled auto-merge January 27, 2025 16:03
@sbliven sbliven enabled auto-merge (squash) January 27, 2025 16:05
@sbliven sbliven merged commit 1a82a2c into SciCatProject:master Jan 28, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants