Skip to content

Commit 2ad66ed

Browse files
authored
Add README.md for SMTP2Graph project
Added detailed information about SMTP2Graph, including features, requirements, environment variables, usage instructions, security considerations, and operational workflow.
1 parent 782ed62 commit 2ad66ed

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# SMTP2Graph
2+
3+
SMTP2Graph is a lightweight SMTP listener that accepts incoming email messages over TCP (port 25) and forwards them to Microsoft 365 mailboxes using the Microsoft Graph API. This allows you to relay SMTP traffic into Exchange Online without exposing traditional SMTP relay services.
4+
5+
## Features
6+
- Minimal SMTP command support (HELO/EHLO, MAIL FROM, RCPT TO, DATA, QUIT)
7+
- Converts incoming MIME messages to Base64 and sends via Microsoft Graph `/users/{id}/sendMail`
8+
- Runs as a standalone .NET application or inside Docker
9+
10+
## Requirements
11+
- .NET 9.0 SDK for building
12+
- Microsoft Graph API credentials (App registration with `Mail.Send` permission)
13+
14+
## Environment Variables
15+
| Variable | Description |
16+
|---------------|--------------------------------------------------|
17+
| `TENANT_ID` | Azure AD tenant ID |
18+
| `CLIENT_ID` | App registration client ID |
19+
| `CLIENT_SECRET`| App registration client secret |
20+
21+
## Usage
22+
### Build and Run Locally
23+
```bash
24+
dotnet restore
25+
dotnet publish SMTP2Graph -c Release -o ./publish
26+
cd publish
27+
TENANT_ID="<tenant>" CLIENT_ID="<client>" CLIENT_SECRET="<secret>" ./SMTP2Graph
28+
```
29+
30+
### Docker Pull and Run
31+
```bash
32+
# Pull the latest image
33+
docker pull ghcr.io/belowaverage-org/smtp2graph:latest
34+
35+
# Run the container
36+
docker run -d \
37+
-e TENANT_ID="<tenant>" \
38+
-e CLIENT_ID="<client>" \
39+
-e CLIENT_SECRET="<secret>" \
40+
-p 25:25 ghcr.io/belowaverage-org/smtp2graph:latest
41+
```
42+
43+
## Security Considerations
44+
- **Do not expose this container publicly without authentication and TLS.**
45+
- Implement IP allowlists or run behind a secure proxy.
46+
- Use Application Access Policies in Microsoft 365 to restrict which mailboxes the app can send as.
47+
48+
## How It Works
49+
1. Listens on port 25 for SMTP commands.
50+
2. Reads MIME content after `DATA` command.
51+
3. Encodes MIME as Base64 and sends via Microsoft Graph using `sendMail` endpoint.

0 commit comments

Comments
 (0)