How to configure automatic email notifications via gmail for every backup job

This article explains how to configure automated email notifications via gmail at the conclusion of every Duplicati operation (backup, restore, etc.). With this approach, every Duplicati job on the machine will send automated notifications – you don’t need to configure each job individually.

You will now see 7 advanced options.

Screenshot 5

The first 3 do not need to be modified. The last 4 need to be modified as follows:

  • Replace destination_email_address@whatever.com with the email address you want the status message sent to.
  • Replace your_sending_gmail_username@gmail.com with the email address of the gmail account you are using to send the message. (Note that there are two places where you need to make this change)
  • Replace your_sending_gmail_password with the password of the gmail account you are using to send the message.
  • Replace This_computers_name with the name of the computer that the backup job is running on.

Click the “OK” button at the bottom of the screen to save your results.

You will now receive an email message at the conclusion of every Duplicati job that is run on the current computer.

This can generate a lot of email clutter – a report for every backup job run. There are two approaches to reducing the volume of email received.

My recommend approach is using dupReport.py to generate summary reports. This excellent tool was developed by @handyguy. If you do this, be sure to modify the “subjectregex=” line in dupReport.rc as shown below to ensure the summary reports work for either the default subject line or the subject line used in this writeup.

subjectregex = ^Duplicati ([\w ]*, |)Backup report for

You also need to add a filter to your email client to automatically move the duplicati-generated email’s out of your inbox and into an email folder which dupReport.py can process.

Alternatively, as suggested by @sanderson, below, you can add this setting:
--send-mail-level=Warning,Error,Fatal

The one downside to this approach is that it doesn’t differentiate between a backup job that succeeded and one that never ran, as the result of both conditions is that no email is sent. This is why I prefer the dupReport.py approach.

Enjoy!

Marc

18 Likes

If you don’t want email on every backup, but only if there is a problem you can added this setting:

--send-mail-level=Warning,Error,Fatal
6 Likes

Brilliant! Thank you.

Thank you very much Marc_Aronson for posting your how-to it works great!
Until now I wasn’t able to find more clear instructions anywhere including this forum.

Thanks for posting this little hint sanderson, it is really helpful!

Hi Stephen, I don’t back up my google docs or email.

I back up my google photos by downloading them via Picassa periodically. I am thinking of switch from this to google takeout at some point.

Marc

Thanks Marc,
but for me this line did not work, so I had to change it:
--send-mail-from=your_sending_gmail_username@gmail.com

P.S.
I do not use Gmail, but my personal email

That’s strange – the notation:
Firstname Lastname <emailaddress@foobar.com>
is standard notation and works on 3 other machines I have configured with duplicati.

If your happy without the “from” email containing the name of the computer backed up, then all is well.

If you want help getting it to work the other way, then PM me your settings exported as text, with any passwords masking out.

THanks!

Marc

Anyone knows why they just don’t add a simple EMAIL ALERT ACCOUNT SETUP within the DUPLICATI setup.
The tool is great, this should be a simple modification compared to all the coding already done.

It just has not been done yet. But I agree, it’s pretty easy to implement :slight_smile:

Did I just hear a volunteer? :wink:

I’ll add it to the end of my to-do list so I can look at it next year :wink:

Hi Marc_Aronson, thanks for the great guide, it works very well.

1 Like

Hey guys, just popping in here to request an update. Looks like you need to add quotes around the subject wording if you have spaces between words.

--send-mail-subject="Duplicati %PARSEDRESULT%, %OPERATIONNAME% report for %backup-name%"

Also, this code needs to be added:

--accept-any-ssl-certificate=true

I don’t know when/if something changed in dupReport, but this how-to needs to be updated to use Source-Destination Pairs.

This means using a --send-mail-subject line like the following (notice the “-My_Backup_System” portion):

--send-mail-subject="Duplicati %PARSEDRESULT%, %OPERATIONNAME% report for %backup-name%-My_Backup_System"

Hello @rinogo, welcome to the forum - and thanks for the reminder for any other new readers on this topic!

Hi, original author here. When I get some spare cycles I’ll upgrade to the latest version to dupReport and update the howto.

Marc

Hi there,

Thank you for this guide.

This may sound a bit obvious, but for the more distracted folks, like myself, you need to enable access for less secure apps in the Google account, or else Gmail will refuse the connection.

I fumbled around with the --send-mail settings of Duplicati for a couple of hours, pulling my hairs, before I remembered that I needed to do that.

Can anyone help with the subjectregex to match this subject?

%PARSEDRESULT%: Duplicati %OPERATIONNAME% report for

Is a colon or dash acceptable after the %PARSEDRESULT%?

I like having the result as the first word to make it easy to see when the email comes in. I understand I won’t look at the individual emails as much once this is working.

I’m not great with code, so don’t fully understand the expressions. Thanks for any assistance in advance!

I was able to finally get it to match %PARSEDRESULT%, Duplicati %OPERATIONNAME% report for (with a comma rather than a colon after %PARSEDRESULT%) using ^([\w ]*, |)Duplicati Backup report for. I’d prefer a colon or dash, but this will work if there’s not a way.

Where are you using this regex - in your email program to filter messages?