Add direct-to-Google-Workspace / direct-to-Microsoft-365 relay delivery - #25
Draft
chrismuench wants to merge 1 commit into
Draft
Add direct-to-Google-Workspace / direct-to-Microsoft-365 relay delivery#25chrismuench wants to merge 1 commit into
chrismuench wants to merge 1 commit into
Conversation
…very Routing rules can now point a domain at the recipient's own inbound mail server instead of a paid relay: GoogleWorkspace delivers unauthenticated to Google's unified inbound endpoint (smtp.google.com, fixed for every Workspace domain), and Microsoft365 delivers unauthenticated to a tenant-supplied *.mail.protection.outlook.com host. Both reuse the existing MailKit SMTP transport (extracted into SmtpDelivery) and are wired into SmtpPortGuard so the existing Azure port-25 block still applies. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
Adds two new relay provider types that deliver mail directly to the recipient's own inbound mail server, so a routing rule for a self-hosted domain doesn't need to pay for or authenticate against a smart-host relay:
smtp.google.com) shared by every Workspace domain, so it's always deliverable unauthenticated on port 25 with STARTTLS.*.mail.protection.outlook.comMX hostname (found in the M365 admin center). Unlike Google's endpoint this is tenant-specific and can't be guessed, so the admin types it in. Also unauthenticated, port 25, STARTTLS.Both reuse the existing MailKit SMTP transport (extracted the connect/send body out of
SmtpProviderinto a shared internalSmtpDeliveryhelper — behavior-preserving refactor) and are wired into the existingSmtpPortGuardso relays on Azure (which blocks outbound port 25) still get the existing clear rejection message instead of a silent connection failure.No DB migration needed —
RelayEntity.Provideris stored as a plain string, and the whole relay config UI/API is schema-driven (RelayProviderSchema), so this only touches the enum, the schema, the factory, and the UI's hand-maintained schema mirror (providers.ts) — no endpoint or form-component code changes.Test plan
dotnet build— solution builds cleandotnet test— all 4 test projects pass (381 tests), including new coverage:RelayProviderFactoryTests— factory builds the right provider type for both new enum valuesSmtpPortGuardTests— both new providers always flagged as port-25 regardless of settingsRelayProviderSchemaTests(new) — GoogleWorkspace has no fields, Microsoft365 requires exactlyHostMicrosoft365ProviderTests(new) — throws whenHostis unset, before any network I/Otsc -btypechecks clean,vite buildsucceeds🤖 Generated with Claude Code