ruvds-backup: add email-notify (Yandex SMTP 587 STARTTLS) + fix size calc
Add dual-channel notifications — ntfy (already there) + email via Send-MailMessage / Yandex SMTP, mirroring VDS msmtp pipeline. Email: noreply@snolla.com -> vitya.kuznetsov@gmail.com. Verified delivered (DKIM pass, SPF pass) via run #2 + manual smoke. Settings sourced from C:\sites\snolla\Web.config <mailSettings> (Yandex SMTP), cross-checked against pass-store snolla-smtp/full-env. Same creds, same account as VDS backup msmtp uses. SMTP port: 587 STARTTLS, NOT 465 implicit-TLS: .NET SmtpClient / Send-MailMessage support only STARTTLS. Yandex accepts both; we use 587 for native PS tooling. VDS msmtp uses 465 implicit-TLS — both work, different tools. Size in email: switched from `rclone size --json | ConvertFrom-Json` (parses fail when rclone NOTICE stderr leaks into stdout) to local Get-ChildItem on C:\sites\snolla. Instant, no JSON dance. setup.ps1: ned params for SMTP creds + OPS_NOTIFY_EMAIL; config.env template extended. README.md: notifications section split into ntfy + email subsections, new SMTP-port + size-calc decisions in Decisions log. Run #2 (12:30:03) and run #3 (12:33) both produced email delivery receipts in user inbox. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,12 @@ param(
|
||||
[string]$NtfyPass = 'Pryakhin9',
|
||||
[string]$NtfyUrl = 'https://ntfy.vds.kzntsv.site',
|
||||
[string]$NtfyTopic = 'vds-backup',
|
||||
[string]$SmtpHost = 'smtp.yandex.ru',
|
||||
[int]$SmtpPort = 587,
|
||||
[string]$SmtpFrom = 'noreply@snolla.com',
|
||||
[string]$SmtpUser = 'noreply@snolla.com',
|
||||
[string]$SmtpPass = 'JP44ajqZ3K#W',
|
||||
[string]$OpsNotifyEmail = 'vitya.kuznetsov@gmail.com',
|
||||
[string]$ScheduleAt = '04:30'
|
||||
)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
@@ -71,12 +77,18 @@ disable_hashcheck = true
|
||||
& cmd.exe /c "icacls `"$base\rclone.conf`" /inheritance:r /grant `"SYSTEM:(F)`" /grant `"BUILTIN\Administrators:(F)`"" | Out-Null
|
||||
Write-Host "[OK] rclone.conf written"
|
||||
|
||||
# 4. config.env
|
||||
# 4. config.env (ntfy + SMTP creds)
|
||||
@"
|
||||
NTFY_URL=$NtfyUrl
|
||||
NTFY_TOPIC=$NtfyTopic
|
||||
NTFY_USER=$NtfyUser
|
||||
NTFY_PASS=$NtfyPass
|
||||
SMTP_HOST=$SmtpHost
|
||||
SMTP_PORT=$SmtpPort
|
||||
SMTP_FROM=$SmtpFrom
|
||||
SMTP_USER=$SmtpUser
|
||||
SMTP_PASS=$SmtpPass
|
||||
OPS_NOTIFY_EMAIL=$OpsNotifyEmail
|
||||
"@ | Set-Content "$base\config.env" -Encoding ASCII -Force
|
||||
& cmd.exe /c "icacls `"$base\config.env`" /inheritance:r /grant `"SYSTEM:(F)`" /grant `"BUILTIN\Administrators:(F)`"" | Out-Null
|
||||
Write-Host "[OK] config.env written"
|
||||
|
||||
Reference in New Issue
Block a user