Repository navigation
Maltonoloco/mail service - #45
Merged
PhilippTheServer merged 8 commits intoAug 26, 2026
Merged
Conversation
added 6 commits
August 20, 2026 01:54
Add a Stripe CLI sidecar that forwards payment events and shares its generated webhook secret with the API. Load the mounted secret dynamically so listener reconnections and secret rotations are handled correctly.
Add an IMAP/SMTP adapter for hosted and self-hosted mail servers. Expose admin endpoints for folders, messages, attachments, sending, moving, flagging, and deleting mail.
Test message validation, stable mail flag values, adapter delegation, and generation of Date headers for outgoing messages.
Provide local SMTP, IMAP, and webmail services with a preconfigured development mailbox for end-to-end testing.
Keep mail routers limited to HTTP concerns and delegate mailbox status, response construction, moves, and flag conversion to MailService. Add coverage for router delegation and flag conversion.
Remove hardcoded payload examples from SuccessResponse and DataResponse so Swagger documents the actual generic type. Document how the mail API uses typed shared responses.
Add create, rename, and delete folder endpoints backed by IMAP. Refactor mailbox use cases into the functions layer, add protected-folder rules, structured audit logging, explicit model exports, programmatic OpenAPI error documentation, and GreenMail lifecycle coverage.
PhilippTheServer
approved these changes
Aug 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature
Description
Adds a provider-neutral mail service for the OpenTaberna admin backend.
The service uses IMAP to access incoming mail and SMTP to send messages. It can connect to hosted or self-hosted mail servers and provides the API foundation required for a future webmail client in the admin frontend.
The implementation includes:
Mailbox operations are separated into router, service, adapter, and model layers. Blocking IMAP and SMTP operations run outside the FastAPI event loop.
Motivation
OpenTaberna needs centralized mailbox functionality that can later be accessed through the admin frontend.
Using an adapter interface keeps the backend independent from a specific mail provider. The current IMAP/SMTP implementation supports standard hosted and self-hosted mail servers, while additional adapters such as Microsoft Graph can be added later.
GreenMail provides an isolated local development environment without requiring a registered domain, external mail server, or DNS configuration.
API Changes
New admin-only endpoints under
/v1/admin/mail:GET /status— return mailbox configuration statusGET /folders— list available foldersGET /folders/{folder}/messages— list and search messagesGET /folders/{folder}/messages/{uid}— retrieve a messageGET /folders/{folder}/messages/{uid}/attachments/{part_id}— download an attachmentPOST /messages— send a messagePOST /folders/{folder}/messages/{uid}/move— move a messagePATCH /folders/{folder}/messages/{uid}/flags— update message flagsDELETE /folders/{folder}/messages/{uid}— delete a messageAll endpoints require an authenticated Keycloak administrator token issued to the configured admin frontend client.
Database Changes
Messages remain on the configured mail server and are accessed through IMAP. The OpenTaberna database does not duplicate mailbox contents.
Documentation
docs/)The new endpoints are included in the generated OpenAPI and Swagger documentation.
The required mailbox environment variables are documented in
.env.example.Testing
Validation performed:
Dateheader testsrc/andtests/Manual development flow verified:
Checklist