How to customize unattended-upgrades notification emails?

Solution 1:

Don't know why they deleted this line on Ubuntu, but Debian includes:

// Set this value to "true" to get emails only on errors. Default
// is to always send a mail if Unattended-Upgrade::Mail is set
//Unattended-Upgrade::MailOnlyOnError "true";

If your /etc/apt/apt.conf.d/50unattended-upgrades don't include the line (and the changelog don't give away this change in presice) is very odd, but at least it doesn't say they changed the behavior. I use a slightly updated version (0.80~sid2 opposed to 0.79.3ubuntu4 that Ubuntu includes in the precise-updates repository) and it will send a mail only on errors (I hasn't get a mail for now). Just write the lines to your configuration file, and everything should be working:

Unattended-Upgrade::Mail "[email protected]";
Unattended-Upgrade::MailOnlyOnError "true";

You may want to run sudo unattended-upgrade -v -d --dry-run to check the entire process yourself.