feat: switch email delivery from Resend to SMTP with libcurl integration
This commit is contained in:
@@ -9,7 +9,7 @@ Install native build dependencies first. On Ubuntu:
|
||||
|
||||
```bash
|
||||
sudo apt install build-essential cmake ninja-build git pkg-config \
|
||||
libjsoncpp-dev uuid-dev zlib1g-dev libssl-dev \
|
||||
libcurl4-openssl-dev libjsoncpp-dev uuid-dev zlib1g-dev libssl-dev \
|
||||
libmariadb-dev libmariadb-dev-compat
|
||||
```
|
||||
|
||||
@@ -95,18 +95,29 @@ The app serves the generated JSON at `/api/v1/openapi.json` and Swagger UI at
|
||||
|
||||
## Email Delivery
|
||||
|
||||
OTP delivery uses Resend HTTP API through Drogon's async `HttpClient`.
|
||||
Set these environment variables before starting backend:
|
||||
OTP delivery uses SMTP through `libcurl`. Local dev defaults to Mailpit.
|
||||
Set these environment variables before starting backend for local Mailpit:
|
||||
|
||||
```bash
|
||||
export MAIL_PROVIDER=resend
|
||||
export RESEND_API_BASE_URL=https://api.resend.com
|
||||
export RESEND_API_KEY=re_xxx
|
||||
export MAIL_PROVIDER=smtp
|
||||
export SMTP_HOST=127.0.0.1
|
||||
export SMTP_PORT=1025
|
||||
export MAIL_FROM=[email protected]
|
||||
```
|
||||
|
||||
Mailpit can still run locally for manual inspection or future integrations, but
|
||||
current backend OTP flow no longer speaks SMTP directly.
|
||||
For Resend in production, use SMTP credentials instead:
|
||||
|
||||
```bash
|
||||
export MAIL_PROVIDER=resend
|
||||
export SMTP_HOST=smtp.resend.com
|
||||
export SMTP_PORT=465
|
||||
export SMTP_USERNAME=resend
|
||||
export SMTP_PASSWORD=re_xxx
|
||||
export SMTP_USE_TLS=true
|
||||
export SMTP_VERIFY_PEER=true
|
||||
export SMTP_VERIFY_HOST=true
|
||||
export MAIL_FROM=[email protected]
|
||||
```
|
||||
|
||||
## Visione Lab
|
||||
|
||||
@@ -157,7 +168,7 @@ multi-architecture Mailpit image to avoid `exec format error` failures on ARM
|
||||
servers.
|
||||
|
||||
Set `DB_NAME`, `DB_USER`, `DB_PASSWORD`, `MYSQL_ROOT_PASSWORD`,
|
||||
`RESEND_API_KEY`, `MAIL_FROM` and
|
||||
`SMTP_PASSWORD`, `MAIL_FROM` and
|
||||
`CORS_ALLOWED_ORIGIN` in Dokploy environment variables. Use the exact browser
|
||||
origin without quotes or a trailing slash, for example
|
||||
`https://visione.studentindipendenti.it`.
|
||||
|
||||
Reference in New Issue
Block a user