I have successfully set up Duplicati to email me using the default settings and now I would like to send an email with a custom format. I understand that I can create a template message body in a file and point to it using the --send-mail-body “message_file.txt” option.
However, it appears that this must be a static file. What I am having trouble figuring out how to do is to create the message body dynamically based on the specific value of %RESULT%.
Is there a way to pass %RESULT% to a script that can dynamically create the message body that --send-mail-body would use?
I am developer of duplicati-monitoring.com, a monitoring service that processes Duplicati backup reports and sends summarized email reports and provides a dashboard.
What we are doing is using the http reporting (
send-http-url option) to send the data to our service, which basically is a script parsing the data and storing it into a database.
Maybe this could be a way to achieve what you want to do?
Another way is what dupReport does: They grab the emails sent by duplicati from the mail server, parse them and generate new emails from it.
You might be able to get something going using –run-script-after. The script is fed lots of information.
I haven’t used this much, so can’t provide much explanation. I’m not sure if the script runs before or after mail sending (if it runs before, then it can write the template), but regardless you can send your own mail.
Linux is probably very well equipped with email senders. On Windows you might have to work a bit more.
How to Send Email From the Command Line in Windows (Without Extra Software)
And to pick a semi-random article on some software to use:
7 Command Line Utilities to Easily Send Email Using SMTP
Thank you for the suggestions. I had seen dupReport when I was searching through the forum for possible solutions to this, but was hoping for a simpler solution and it was not clear how I could easily customize the dupReport reports.
I had not heard of duplicati-monitoring.com. Neat service! Unfortunately, I can’t take advantage of a service like this because my network is not open to general internet traffic.
Again, thanks for the great ideas.
Thanks. I had seen this option, but came to the same conclusions as you did: 1) it wasn’t clear if this was run before or after an email would be sent (I could test this, but was a feeling a bit lazy when I wrote my email), 2) it looked like I would have to set up my own email sender.
I am running this on Windows and didn’t know how to send the emails. The links you supplied are great!! Another option I thought of was calling a Linux tool from within Windows using the Windows Subsystem for Linux (WSL).