Add email delivery for generated reports
This commit is contained in:
@@ -28,6 +28,7 @@ PVE_TASK_HISTORY_LIMIT=500
|
||||
PBS_HOSTNAMES=backup.example.invalid=display-name
|
||||
LOG_LEVEL=INFO
|
||||
REPORT_FILENAME_PREFIX=rapport-sauvegardes-pve
|
||||
REPORT_EMAIL_ENABLED=false
|
||||
```
|
||||
|
||||
## Variable Description
|
||||
@@ -56,6 +57,46 @@ REPORT_FILENAME_PREFIX=rapport-sauvegardes-pve
|
||||
| `PBS<number>_TIMEOUT_SECONDS` | No | HTTP timeout for this PBS server. Default: `PVE_TIMEOUT_SECONDS` or `30`. |
|
||||
| `LOG_LEVEL` | No | Log level. Default: `INFO`. |
|
||||
| `REPORT_FILENAME_PREFIX` | No | PDF filename prefix. |
|
||||
| `REPORT_EMAIL_ENABLED` | No | Enables sending the generated PDF by email. Default: `false`. |
|
||||
| `REPORT_EMAIL_SMTP_HOST` | If email enabled | SMTP server. |
|
||||
| `REPORT_EMAIL_SMTP_PORT` | No | SMTP port. Default: `587`. |
|
||||
| `REPORT_EMAIL_SMTP_STARTTLS` | No | Enables STARTTLS. Default: `true`. Incompatible with `REPORT_EMAIL_SMTP_SSL=true`. |
|
||||
| `REPORT_EMAIL_SMTP_SSL` | No | Uses implicit TLS SMTP, often port `465`. Default: `false`. |
|
||||
| `REPORT_EMAIL_SMTP_USERNAME` | No | SMTP username. If set, `REPORT_EMAIL_SMTP_PASSWORD` is required. |
|
||||
| `REPORT_EMAIL_SMTP_PASSWORD` | No | SMTP password, read only from the environment and never displayed. |
|
||||
| `REPORT_EMAIL_FROM` | If email enabled | Message sender address. |
|
||||
| `REPORT_EMAIL_TO` | If email enabled | Comma-separated recipients. |
|
||||
| `REPORT_EMAIL_SUBJECT` | No | Message subject. Default: `Rapport sauvegardes PVE`. |
|
||||
| `REPORT_EMAIL_SMTP_TIMEOUT_SECONDS` | No | SMTP timeout. Default: `30`. |
|
||||
|
||||
## Email Delivery
|
||||
|
||||
Email delivery is optional and disabled by default. When `REPORT_EMAIL_ENABLED=true`, the `--generate-pdf` command first writes the timestamped PDF to `REPORT_OUTPUT_DIR`, then sends it as an attachment. If sending fails, the PDF remains on disk and the command returns an error so cron or monitoring can report it.
|
||||
|
||||
Example with STARTTLS:
|
||||
|
||||
```env
|
||||
REPORT_EMAIL_ENABLED=true
|
||||
REPORT_EMAIL_SMTP_HOST=smtp.example.invalid
|
||||
REPORT_EMAIL_SMTP_PORT=587
|
||||
REPORT_EMAIL_SMTP_STARTTLS=true
|
||||
REPORT_EMAIL_SMTP_SSL=false
|
||||
REPORT_EMAIL_SMTP_USERNAME=backup-report@example.invalid
|
||||
REPORT_EMAIL_SMTP_PASSWORD=
|
||||
REPORT_EMAIL_FROM=backup-report@example.invalid
|
||||
REPORT_EMAIL_TO=admin@example.invalid,audit@example.invalid
|
||||
REPORT_EMAIL_SUBJECT=PVE backup report
|
||||
```
|
||||
|
||||
Example with implicit TLS:
|
||||
|
||||
```env
|
||||
REPORT_EMAIL_SMTP_PORT=465
|
||||
REPORT_EMAIL_SMTP_STARTTLS=false
|
||||
REPORT_EMAIL_SMTP_SSL=true
|
||||
```
|
||||
|
||||
Do not put SMTP passwords in the Docker image, logs or committed documentation. Use `.env`, a runtime environment variable or a Docker secret mounted at startup.
|
||||
|
||||
## Docker Compose Example
|
||||
|
||||
|
||||
Reference in New Issue
Block a user