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

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:


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.


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?

Hey JonMike, I’m using it in the script. This is part of the DupReport.rc file which Marc posted about in this thread. I’m just trying to modify his wildcard a bit to capture all of the emails I already have in my mailbox from multiple PC backups. Does that clarify things?

There are some cases where a colon or a dash have a special meaning in a regex. Try escaping the characters in your regex (as in ‘\:’ or ‘\-’ but without the quotes) and see if that helps.

Thanks handyguy. I tried ^([\w ]*: |) and ^([\w ]*,: |).

I’m not sure what the comma is for after the asterisk, so I tried with and without it but neither worked. Sorry, this is my first time using Python. I can just change my email subject format to match what is already working so as not to waste anyone’s time.


Don’t give up so easily! I was able to use:

^\w+: Duplicati Backup report for

and it matched “Success: Duplicati Backup report for test1-test2”. The secret to parsing regex’s is to try to keep the expression as simple as possible. The above regex says the following:

  • ^ - Match the beginning of the line
  • \w - match any alphanumeric: [0-9a-zA-Z_]
  • + - match one or more instances of the previous spec (i.e., alphanumeric)
  • : - match the colon character immediately following the alphanumeric characters
  • (space) - match a single space character after the colon. You can also use ‘\s’ to match any whitespace character (including tab, newline, etc.). If you anticipate multiple space characters you can use ‘\s+’ (specifying one or more instances of \s).
  • Duplicati Backup report for… - match the literal string

I think the parentheses and the pipe character (’|’) in your original regex were throwing your match off, as each has it’s own special meaning in regex’s.

There’s a good regex parsing page at that lets you put in your regular expression and test strings to see if they match.

I can just change my email subject format to match what is already working so as not to waste anyone’s time.

Make the technology work the way you want, not the other way around! :wink:

Hope this helps.


I cannot strongly enough recommend people not use their primary gmail account for this, as the password is stored in the clear unless you encrypt the duplicati config. Set up a dedicated account for sending the email from.


Thanks a lot for the Pythex suggestion. That is exactly what I needed to do my testing. I’m just way over my head on this stuff, and I don’t like asking someone to spell it out for me due to the time it takes, but thanks for doing that anyway.

Unfortunately, the software does not seem to agree with Pythex. I have tried many different expressions, which match in Pythex but produce an empty table when used in dupReport.rc. Here are a few examples below that match in Pythex, but don’t work in the RC file.

  • subjectregex = ^\w+: Duplicati Backup report
  • subjectregex = ^\w+:\sDuplicati Backup report
  • subjectregex = ^(\w+: |)Duplicati Backup report
  • subjectregex = ^\w+:|Duplicati Backup report
  • subjectregex = Duplicati Backup report

I don’t really see why matching the beginning of the line is required in this case. I feel like I should just be able to search the string “Duplicati Backup report”. Again, works in Pythex, not in the RC. Am I doing something wrong? My exact email subject is as you stated. “Success: Duplicati Backup report for test1-test2” without the quotes.

In Duplicati I’m using this string.

  • –send-mail-subject=%PARSEDRESULT%: Duplicati %OPERATIONNAME% report for %backup-name%

Also, FYI, the dupReport.rc file had two “outsender” settings in the [outgoing] section RC file. I removed one and it seems to work ok.

@NotHere. I agree. I do wish there was an easy way to encrypt it. I did make a dedicated gmail account and also used an application specific password, so it can’t be used to log into the account.

Although I have no answer for dash, colon fails might be extractHeaders code taking “Success:” as a header, which will cause the regex to fail because it expects that to be part of the string following a “Subject:” header. Another guess is that the configuration parser which is documented as taking a colon or equals, is confused.
Basically, the Pythex exam is useful, but the regex and the subject line both have to get there as they should.

Thanks, I re-tried with the dash instead of a colon and it works just fine. With this method I can just use

  • subjectregex = Duplicati Backup report

and it works great. It definitely doesn’t like the colon for some reason.

EDIT - Note I originally thought this worked, but later realized using the dash broke the source/destination portion. Continue reading below for a fix.

To figure out which of the two reasons it is, you could try adjusting Duplicati and subjectregex to have a space before the colon. I think that will be enough to avoid mistaken identity. Header parser needs a colon attached.

Putting the space before the colon works using the same regex as my last message. I’m sure it would work with the wildcards as well, but it seems unnecessary to me since I’ll never have other emails with those words in the subject in this mailbox.

I think that’s evidence that Duplicati information after the email Subject: string was missing before. Thanks. Maybe dupReport will someday recognize “header” names only at start of the line. Multiline mode might help. Meanwhile, I’m glad you found a workaround that is enough for your situation and for others doing the same.