Hi,
on RouterOS 7.22.2 I can send backup e-mails manually from terminal, including multiline body and two attachments, but the BackupAndUpdate script fails when sending the same data from script.
Working manual command pattern:
:local NL "\r\n"
:local body ("System backups have been successfully created and attached to this email." . $NL . $NL . "Device information:" . $NL . "RouterOS version: v7.22.2 (stable)")
/tool e-mail send to=user@example.com subject="manual-full-body-two-files" body=$body file="backup.backup,backup.rsc"
Observed script errors:
Error sending e-mail <...>: socket error
Earlier multiline body tests also showed:
invalid BODY
Findings:
- Multiline body works when built with CRLF ("\r\n"), but fails or is unstable with "\n".
- Sending two attachments works when file= receives a comma-separated string:
backup.backup,backup.rsc
- Sending from script is unstable when attachments are passed as RouterOS array:
{$backupFileSys;$backupFileConfig}
- Dynamic subjects containing backticks around identity names may also trigger send instability on 7.22.
- Backup files should only be deleted after /tool e-mail get last-status is confirmed as succeeded.
Suggested fix:
- Build mail body with CRLF.
- Return attachment list as comma-separated string instead of array.
- Avoid backticks or special formatting in mail subject.
- Delete backup files only after confirmed successful delivery.
Environment:
- RouterOS: 7.22.2 stable
- Script mode: backup
- E-mail sending from terminal works
- E-mail sending from script fails with same attachments unless adjusted as above
Hi,
on RouterOS 7.22.2 I can send backup e-mails manually from terminal, including multiline body and two attachments, but the BackupAndUpdate script fails when sending the same data from script.
Working manual command pattern:
:local NL "\r\n"
:local body ("System backups have been successfully created and attached to this email." . $NL . $NL . "Device information:" . $NL . "RouterOS version: v7.22.2 (stable)")
/tool e-mail send to=user@example.com subject="manual-full-body-two-files" body=$body file="backup.backup,backup.rsc"
Observed script errors:
Error sending e-mail <...>: socket error
Earlier multiline body tests also showed:
invalid BODY
Findings:
backup.backup,backup.rsc
{$backupFileSys;$backupFileConfig}
Suggested fix:
Environment: