Add SMTP configuration and documentation

- Update .env.example with SMTP variables
- Create docs/SMTP.md with credentials and usage examples
- Tested successfully on 2025-12-05

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
rever-tecnologia 2025-12-05 16:14:15 -03:00
parent bfcec46328
commit 4b1198271d
2 changed files with 81 additions and 9 deletions

View file

@ -16,15 +16,14 @@ REMOTE_ACCESS_TOKEN_GRACE_MS=900000
# SQLite database (local dev) # SQLite database (local dev)
DATABASE_URL=file:./prisma/db.dev.sqlite DATABASE_URL=file:./prisma/db.dev.sqlite
# Optional SMTP (dev) # SMTP Configuration (production values in docs/SMTP.md)
# SMTP_ADDRESS=localhost SMTP_HOST=smtp.c.inova.com.br
# SMTP_PORT=1025 SMTP_PORT=587
# SMTP_TLS=false SMTP_SECURE=false
# SMTP_USERNAME= SMTP_USER=envio@rever.com.br
# SMTP_PASSWORD= SMTP_PASS=P@W#rvr00
# SMTP_AUTHENTICATION=login SMTP_FROM_NAME=Sistema de Chamados
# SMTP_ENABLE_STARTTLS_AUTO=false SMTP_FROM_EMAIL=envio@rever.com.br
# MAILER_SENDER_EMAIL=no-reply@example.com
# Dev-only bypass to simplify local testing (do NOT enable in prod) # Dev-only bypass to simplify local testing (do NOT enable in prod)
# DEV_BYPASS_AUTH=0 # DEV_BYPASS_AUTH=0

73
docs/SMTP.md Normal file
View file

@ -0,0 +1,73 @@
# Configuracao SMTP
Configuracao do servidor de email para envio de notificacoes do sistema.
## Credenciais
| Campo | Valor |
|-------|-------|
| Host | `smtp.c.inova.com.br` |
| Porta | `587` |
| TLS/SSL | STARTTLS (secure: false) |
| Usuario | `envio@rever.com.br` |
| Senha | `P@W#rvr00` |
| Remetente | `Sistema de Chamados <envio@rever.com.br>` |
## Variaveis de Ambiente
```bash
SMTP_HOST=smtp.c.inova.com.br
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=envio@rever.com.br
SMTP_PASS=P@W#rvr00
SMTP_FROM_NAME=Sistema de Chamados
SMTP_FROM_EMAIL=envio@rever.com.br
```
## Exemplo de Uso (Nodemailer)
```typescript
import nodemailer from "nodemailer"
const transporter = nodemailer.createTransport({
host: process.env.SMTP_HOST,
port: Number(process.env.SMTP_PORT),
secure: process.env.SMTP_SECURE === "true",
auth: {
user: process.env.SMTP_USER,
pass: process.env.SMTP_PASS,
},
tls: {
rejectUnauthorized: false,
},
})
await transporter.sendMail({
from: `"${process.env.SMTP_FROM_NAME}" <${process.env.SMTP_FROM_EMAIL}>`,
to: "destinatario@exemplo.com",
subject: "Assunto do email",
html: "<p>Conteudo do email</p>",
})
```
## Teste Realizado
- **Data**: 2025-12-05
- **Resultado**: Sucesso
- **Message ID**: `<2df8cfca-0c56-7710-2f10-290961e3f1b7@rever.com.br>`
- **Resposta**: `250 2.0.0 Ok: queued as 4D4C91402426A`
## Configuracao na VPS
Adicionar as variaveis ao arquivo de secrets do Docker Swarm ou ao `.env` de producao:
```bash
# Via SSH na VPS
ssh -i ~/.ssh/codex_ed25519 root@154.12.253.40
# Editar o arquivo de ambiente do servico web
nano /root/sistema/.env
# Adicionar as variaveis SMTP listadas acima
```