SMTP Proxy
SMTP-to-API Email Relay
The SMTP Proxy is a local SMTP server that accepts emails from applications and forwards them via configured providers (M365, Gmail, SMTP).
Overview
The SMTP Proxy solves a common problem: many legacy applications can only send via SMTP, but modern email services like Microsoft 365 or Google Gmail require OAuth-based APIs.
The SMTP Proxy listens locally on a configurable port (default: 2525) and accepts standard SMTP connections. The emails are then delivered via the configured provider — either Microsoft Graph API, Google Gmail API or a classic SMTP server.
How It Works
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ Legacy App │────▶│ SMTP Proxy │────▶│ Email Provider │ │ (send SMTP) │ │ (Port 2525) │ │ • M365 Graph │ │ │ │ • Check auth │ │ • Google Gmail │ │ Scanner │ │ • Parse mail │ │ • SMTP Relay │ │ ERP System │ │ • Forward │ │ │ │ Monitoring │ │ • Log │ │ │ └─────────────────┘ └─────────────────┘ └─────────────────┘
Features
- Multi-provider — Microsoft 365 (Graph API), Google Gmail (OAuth) or direct SMTP relay.
- SMTP-to-API bridge — Legacy applications send via SMTP, the proxy forwards via modern APIs.
- Attachment support — Multipart messages and attachments are correctly processed and forwarded.
- SMTP authentication — Optional PLAIN/LOGIN authentication for incoming connections.
- Sender validation — For M365: allowed sender list (full emails or domain patterns).
- Secret expiry monitoring — Automatic warning before M365 client secret expiration.
- Delivery log — Every sent and failed email is logged in the database.
- Connection testing — Test provider connectivity before production use.
- Statistics — Uptime, total sent, error rate and last error message.
Usage
- Open component — Navigate to Components > SMTP Proxy in AdminUI.
- Choose provider — Select the email provider: Microsoft 365, Google Gmail or direct SMTP.
- Configure provider — Enter provider-specific credentials (e.g. Tenant ID and Client Secret for M365).
- Set sender — Define the default sender address.
- Test connection — Send a test email to verify the provider configuration.
- Set listen address — Default:
127.0.0.1:2525. For network access:0.0.0.0:2525. - Enable auth — For network access: enable SMTP AUTH and set credentials.
- Start proxy — Enable and start the SMTP proxy.
- Configure applications — Configure legacy applications to send SMTP via
host:2525.
Best Practices
- Prefer M365 — Microsoft 365 offers the best deliverability and requires no open SMTP ports.
- Monitor client secret expiry — For M365, the client secret expiration date is tracked. Renew it in time.
- Enable authentication — Enable SMTP AUTH to prevent unauthorized sending, especially when the proxy is network-accessible.
- Send test mail — Send a test email after every configuration change to verify delivery.
- Maintain sender list — For M365: define allowed sender addresses or domains to prevent abuse.
- Check logs — The SMTP proxy logs every sent/failed mail in the database.
Examples
1. Microsoft 365 as Provider
Host: 127.0.0.1 Port: 2525 Provider: m365 Tenant ID: xxxx-xxxx Client ID: yyyy-yyyy Client Secret: zzzz Sender: noreply@company.com
Legacy applications send to 127.0.0.1:2525, the proxy forwards via Microsoft Graph API.
2. SMTP Relay with STARTTLS
Host: 127.0.0.1 Port: 2525 Provider: smtp SMTP Host: mail.company.com SMTP Port: 587 STARTTLS: true Username: smtp_user Password: ***
3. With Authentication (Network-Safe)
Host: 0.0.0.0 (network access) Port: 2525 Auth required: true Auth Username: relay_user Auth Password: *** Provider: m365