Overview Dashboard
Real-time LAN SMTP relay activity statistics.
Live Relayed Mails
| Sender | Recipient | Provider | Status | Time |
|---|---|---|---|---|
| No recent mail activity found. | ||||
Quick Reference Configuration
Point your LAN devices (scanners, printers, internal apps) to this gateway:
SMTP Server: [YOUR_SERVER_LAN_IP] Port: 25 Auth: None (Subnet Authorized) Encryption: None / Optional
Allowed LAN ranges are configured via the LAN_SUBNETS environment variable in your docker-compose file.
Relay & Routing Rules
Configure how outgoing email domains/addresses map to M365 Graph, Google Workspace, or SMTP upstreams.
| Sender Pattern | Upstream Provider | Status | Configuration Details | Actions |
|---|---|---|---|---|
| Loading relay rules... | ||||
Complete Mail Log
Search and inspect transmission logs and API responses.
| Time | Sender | Recipient | Subject | Provider | Status | Details |
|---|---|---|---|---|---|---|
| Loading transmission logs... | ||||||
Upstream API Setup Guide
Step-by-step instructions to register your app and grant permissions in Microsoft 365 and Google Workspace.
Microsoft 365 App Registration
To relay emails via the Microsoft Graph API, you must register a Service Application in Azure AD (Microsoft Entra ID) and authorize it to send emails on behalf of tenant users.
- Log in to Entra ID Portal: Navigate to the Azure Portal and select Microsoft Entra ID (Azure Active Directory).
-
Register a New App:
Go to App registrations > New registration.
- Name:
LAN Mail Gateway - Supported account types: Accounts in this organizational directory only (Single tenant)
- Redirect URI: Leave blank
- Click Register.
- Name:
- Record Identifiers: From the Overview page, copy the Application (client) ID and Directory (tenant) ID.
-
Generate Client Secret:
Go to Certificates & secrets > Client secrets > New client secret.
- Description:
mailgw-auth-key - Expires: Select your preference (e.g. 24 months)
- Click Add and immediately copy the secret Value (not ID). It will be masked forever if you leave the page.
- Description:
-
Grant API Permissions:
Go to API permissions > Add a permission.
- Select Microsoft Graph > Application permissions (not Delegated).
- Search for and select
Mail.Send. - Click Add permissions.
- Admin Consent: Under the API Permissions list, click Grant admin consent for [Your Tenant] and confirm. Status should show a green checkmark.
Security Best Practice: Restricting Senders
By default, Mail.Send permits the application to send mail as *any* user in the tenant. You can restrict the app to specific users/devices (e.g. only [email protected]) by running this command in Exchange Online PowerShell:
New-ApplicationAccessPolicy -AppId "YOUR_CLIENT_ID" -PolicyScopeGroupId "[email protected]" -AccessRight SendAccess -Description "Limit mailgw relay scope"
Google Workspace Domain-Wide Delegation
To send emails on behalf of any Google Workspace account, you must create a Service Account in a Google Cloud Project and authorize it with Domain-Wide Delegation in the Workspace Admin Console.
-
Create a Google Cloud Project:
Go to the Google Cloud Console and create a project (e.g.,
mailgw-project). - Enable the Gmail API: Navigate to the API Library, search for the Gmail API, and click Enable.
-
Create a Service Account:
Go to IAM & Admin > Service Accounts > Create Service Account.
- Name:
mailgw-service-account - Click Create and Continue. Skip roles assignment and click Done.
- Name:
-
Record Client ID & Download Key:
- Click on the newly created Service Account. Under the Details tab, copy the numeric Unique ID (this is your OAuth Client ID).
- Go to the Keys tab > Add Key > Create new key > Select JSON > Click Create. A file will download. This file contains the private key that you will upload to the mailgw dashboard.
-
Configure Domain-Wide Delegation:
Go to the Google Workspace Admin Console.
- Navigate to Security > Access and data control > API controls.
- Under Domain-wide delegation, click Manage Domain-wide Delegation.
- Click Add new.
- In the Client ID field, paste the numeric Unique ID of the service account.
- In OAuth scopes, copy-paste:
https://www.googleapis.com/auth/gmail.send - Click Authorize.
SMTP Ingress & Access Control
Configure whether LAN/Docker subnets can relay without credentials or require strict SMTP authentication (SASL).
SMTP Ingress Access Policy
Controls Postfix smtpd_relay_restrictions and mynetworks in real time.
SASL Authenticated Users (smtp_users)
| Username / Mail Address | Status | Created At | Actions |
|---|---|---|---|
| Loading SMTP users... | |||