email-backup: use $SendEMail2

This drops $EmailBackupTo & $EmailBackupCc from settings! Use settings
overwrite if required:

:global EmailGeneralToOverride {
  "email-backup"="backup@example.com";
}
This commit is contained in:
Christian Hesse 2021-04-29 16:26:31 +02:00
parent 529cefffaf
commit d2560db5c9
6 changed files with 15 additions and 23 deletions

View file

@ -15,8 +15,6 @@
:global BackupSendBinary;
:global BackupSendExport;
:global Domain;
:global EmailBackupCc;
:global EmailBackupTo;
:global Identity;
:global CharacterReplace;
@ -25,6 +23,7 @@
:global MkDir;
:global RandomDelay;
:global ScriptFromTerminal;
:global SendEMail2;
:global WaitForFile;
:global WaitFullyConnected;
@ -33,10 +32,6 @@
$LogPrintExit2 error $0 ("Configured to send neither backup nor config export.") true;
}
:if ([ :len $EmailBackupTo ] = 0) do={
$LogPrintExit2 error $0 ("Configuration is missing recipient for e-mail backup.") true;
}
$WaitFullyConnected;
:if ([ $ScriptFromTerminal $0 ] = false && $BackupRandomDelay > 0) do={
@ -71,11 +66,11 @@ $WaitFullyConnected;
}
# send email with status and files
/ tool e-mail send to=$EmailBackupTo cc=$EmailBackupCc \
subject=("[" . $Identity . "] Backup & Config") \
body=("See attached files for backup and config export for " . \
$Identity . ".\n\n" . \
[ $DeviceInfo ] . "\n\n" . \
"Backup file: " . $BackupFile . "\n" . \
"Config file: " . $ConfigFile) \
file=$Attach;
$SendEMail2 ({ origin=$0; \
subject=("Backup & Config"); \
message=("See attached files for backup and config export for " . \
$Identity . ".\n\n" . \
[ $DeviceInfo ] . "\n\n" . \
"Backup file: " . $BackupFile . "\n" . \
"Config file: " . $ConfigFile); \
attach=$Attach });