How to set up email notification with Gmail

You can send email reports by supplying some options to a backup job. You can do this in every backup job or in the Settings page. This is the preferred method, because you have to configure it once to make it work for all your backup jobs.

You have to specify at least one option: --send-mail-to. All other mail-related options have default values, which you can change by specifying them. So the first thing you can try is using only this option. You can test if this works by typing from the command line:
Duplicati.CommandLine.exe send-mail --send-mail-to=yourname@yourdomain.com.

If you don’t receive a test message, you can troubleshoot what’s going wrong with this command: Duplicati.CommandLine.exe send-mail --send-mail-to=yourname@yourdomain.com --verbose --log-level=profiling.

For sending mails from and/or to GMail adresses, I had to supply some other options:
Duplicati.CommandLine.exe send-mail --send-mail-to=youraddress@gmail.com --send-mail-from=youraddress@gmail.com --send-mail-url=smtps://smtp.gmail.com:465 --send-mail-username=youraddress@gmail.com --send-mail-password=yourpassword --send-mail-subject=Testmessage --verbose --log-level=profiling

Result was that I received a warning in my GMail mailbox, indicating that an unsafe app was trying to use my GMail account. In that warning message was a link to the settings page where the blocking could be disabled.
After allowing unsafe apps to use my GMail account, the test message was delivered successfully.

In the advanced options on the Settings page, I have specified these values for my GMail account:

--send-mail-from=youraddress@gmail.com
--send-mail-url=smtps://smtp.gmail.com:465
--send-mail-username=youraddress@gmail.com
--send-mail-password=yourpassword
--send-mail-subject=%PARSEDRESULT%: Duplicati %OPERATIONNAME% report for %backup-name%

Of course you can also use the SMTP server of your ISP as Smart host to deliver outgoing mail.
You can also add the options --send-mail-level=all to send an email after every backup task (including seccessful results) and --send-mail-any-operation=true to send mail after any type of operation (for example restore operations).

You can see how it works in this tutorial:

Hope this helps.

5 Likes