diff --git a/carichello.py b/carichello.py index 09a09da..f707d86 100644 --- a/carichello.py +++ b/carichello.py @@ -357,6 +357,17 @@ class Carichello: return self.error_exception(exc) LOG.info("ready: %s", url) self.set_clipboard(url) + mail_to = self.config.get('mail', {}).get('to', None) + if mail_to: + hostname = subprocess.check_output(['hostname', '-f'], encoding='utf8').strip() + try: + subprocess.run( + ['mail', '-s', 'Nuovo file caricato', mail_to], + input=f"{hostname}\n\n{url}", + encoding='utf8', + ) + except subprocess.CalledProcessError: + LOG.error("error sending email") subprocess.run( [ "zenity", diff --git a/config.json b/config.json index e01a81e..ecb0b39 100644 --- a/config.json +++ b/config.json @@ -1,4 +1,7 @@ { + "mail": { + "to": "foobar@example.com" + }, "backends": [ { "type": "archive.org",