Outlook Autoreply Helper
A Python package that automatically manages Outlook auto-reply settings via the Microsoft Graph API. Perfect for scheduling out-of-office messages during vacations or other absences.
Features
- 🔄 Automatic detection of vacation events from your Outlook calendar
- 📅 Smart handling of adjacent or overlapping vacation periods
- ✨ Customizable auto-reply messages using Jinja2 templates
- 🌐 Uses Microsoft Graph API
- 🔑 Persistent token cache for unattended operation
- 🔒 Supports local and Azure Key Vault cache storage
- ☁️ Flexible configuration storage:
- Local machine (environment variables / .env file)
- Azure Key Vault (for unattended server deployments)
- 🔐 Supports multiple authentication flows for initial setup:
- Interactive browser-based authentication
- Device code flow for headless environments
Installation
pip install outlook-autoreply-helper
Alternatively, you can skip the explicit installation and use uv to run the application in an ephemeral Python environment; see below.
Quick Start
-
Register an application in Azure AD:
- Go to Azure Portal > Azure Entra ID > Manage > App registrations.
- Create a new registration "Outlook Autoreply Helper".
- Go to Manage -> Authentication and add the "Mobile and desktop applications" platform.
- Add the redirect URI:
http://localhostto the platform. This is needed for initial authentication when using the Interactive Flow. You do not need this setting if you are using the Device Code Flow. - In the "Implicit grant and hybrid flows" section, ensure that "Access tokens (used for implicit flows)" is selected.
- Add Microsoft Graph API permissions:
Calendars.Read,MailboxSettings.ReadWrite. Ensure you add delegated permissions, not application permissions, as the application needs to access data on behalf of the user. - Note down the Application (client) ID and Directory (tenant) ID.
-
Create a configuration file (
.env):app__tenant_id=<your-tenant-id> app__client_id=<your-client-id> app__auth_flow=interactive # or 'device_code' absence__keyword=Vacation # Keyword to look for in the subject of the calendar event
-
Initialize the application:
outlook-autoreply-helper initYou will be prompted to authenticate and consent to the application accessing your calendar and mailbox settings.
If you are using
uv, you also run the application viauvx outlook_autoreply_helper init
-
Run the application:
outlook-autoreply-helper runThe application will check for upcoming events and update your mailbox settings accordingly.
Again, using
uvthis can also be done viauvx outlook_autoreply_helper run
Configuration
The application supports different options for storing configuration and state (e.g. access tokens) that should be shared between runs.
Local Configuration
Store settings in environment variables or a .env file:
# App Registration Settings
app__tenant_id=<tenant-id>
app__client_id=<client-id>
app__auth_flow=interactive # or 'device_code'
absence__keyword=Vacation # Keyword to look for in the subject of the calendar event
The remaining settings have sensible defaults and can be left out; see .env.example.
By default, the application uses the local file system to store state. For example, access tokens are cached in a local file in the current working directory to reduce the need for re-authentication. See the example in examples/local/.
Using Azure Key Vault for Caches
For unattended server deployments, state that should be shared between runs can be stored in an Azure Key Vault. Just modify the .env file to use the keyvault cache type and provide the URL of the key vault:
...
cache__type=keyvault
cache__keyvault_url=https://<your-keyvault>.vault.azure.net
When you run locally, you may be prompted to login to the Azure account that hosts the key vault. You can do this e.g. via the Azure CLI:
az login
When the application runs in an unattended environment, you need to ensure the application can access the key vault as well. If you are deploying to an Azure Function, then you need to add an appropriate role assignment for the role Key Vault Secrets Officer for the corresponding Function App's managed identity in the key vault's IAM settings.
Note that the Azure tenant that hosts the key vault and the app registration that the application uses to manage the calendar and mailbox settings for a user may reside in different tenants. See examples/az_keyvault_cache/ for an example.
Using Azure Key Vault for Configuration
In addition to storing caches in Azure Key Vault, you can also store all or parts of the configuration there.
Simply set the environment variable AZURE_KEY_VAULT_URL to the URL of the corresponding key vault.
Each setting can then be stored as a secret in the key vault; see the Pydantic documentation for details. This is particularly useful to store the auto-reply templates for unattended operation, since they can still be easily changed by the user without the need to redeploy the application.
See ./examples/az_keyvault_cache_and_settings/ for an example.
Auto-reply Templates
Customize your auto-reply messages using Jinja2 templates. Variables available in templates:
vacation_start: Start date of absencevacation_end: End date of absence
Example template:
I am out of office from {{ vacation_start | date }} to {{ vacation_end | date }}.
I will respond to your message after my return.
The custom filter date formats the date in the desired format. You can change it to any format supported by Python's strftime function via the àbsence__date_format` setting in the configuration:
...
absence__date_format=%Y-%m-%d
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the Apache License, Version 2.0 - see the LICENSE file for details.
Metadata
Release files for outlook-autoreply-helper 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| outlook_autoreply_helper-0.1.2.tar.gz | 57.2 kB | With provenance | Details for outlook_autoreply_helper-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| outlook_autoreply_helper-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for outlook_autoreply_helper-0.1.2-py3-none-any.whl |
Total release size: 76.0 kB
Release files / outlook_autoreply_helper-0.1.2.tar.gz
| Download URL | outlook_autoreply_helper-0.1.2.tar.gz |
|---|---|
| Size | 57.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a6c20b6988721ad48722353247bc2c0fd4bd2948f586ddda93fa6fb52ba091df
|
|
BLAKE2b-256 checksum How to use checksums |
0fab8ff4b8bbbfcb79ff9b145529951e2aa847253b69462d19464dd83e9104e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2024.
Transparency logRelease files / outlook_autoreply_helper-0.1.2-py3-none-any.whl
| Download URL | outlook_autoreply_helper-0.1.2-py3-none-any.whl |
|---|---|
| Size | 18.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
130bd44c03f2ac9972f5d2f2c2b4fc78a6bc05b0f1b6c599323b80aff76fe6cd
|
|
BLAKE2b-256 checksum How to use checksums |
901937f287faf3b390611a62931e82564e833cb810d8464091bf7bdde26c8412
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2024.
Transparency logSecurity for outlook-autoreply-helper 0.1.2
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for outlook_autoreply_helper-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 2, 2024.
Transparency logA 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.