From 5c0b15c513dea4fc702d6bd03f241fa44bbba705 Mon Sep 17 00:00:00 2001 From: Martin Monperrus Date: Tue, 12 Mar 2024 07:31:21 +0100 Subject: [PATCH] email reporter: Allow multiple recipients for sendmail method (#797, by monperrus) Co-authored-by: Thomas Perl --- CHANGELOG.md | 1 + docs/source/reporters.rst | 17 ++++++++++++++++- lib/urlwatch/mailer.py | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99436961..8b119a74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ The format mostly follows [Keep a Changelog](http://keepachangelog.com/en/1.0.0/ ### Fixed +- `email` reporter: Allow multiple recipients for `sendmail` method (#797, by monperrus) - Fix documentation for watching Github tags and releases, again (#723) - Fix `--test-reporter` command-line option so `separate` configuration option is no longer ignored when sending test notifications (#772, by marunjar) - Fix line height and dark mode regression (#774 reported by kongomongo, PRs #777 and #778 by trevorshannon) diff --git a/docs/source/reporters.rst b/docs/source/reporters.rst index 54326f0d..198620f6 100644 --- a/docs/source/reporters.rst +++ b/docs/source/reporters.rst @@ -61,7 +61,7 @@ The list of built-in reporters can be retrieved using:: At the moment, the following reporters are built-in: - **discord**: Send a message to a Discord channel -- **email**: Send summary via e-mail / SMTP +- **email**: Send summary via e-mail / SMTP / sendmail - **ifttt**: Send summary via IFTTT - **mailgun**: Send e-mail via the Mailgun service - **matrix**: Send a message to a room using the Matrix protocol @@ -290,6 +290,21 @@ public Matrix room, as the messages quickly become noisy: minimal: true enabled: true +E-Mail via sendmail +--------------------- + +You can send email via the system's ``sendmail`` command provided by the MTA. You need to set ``method: sendmail`` in the config file: + +.. code:: yaml + + report: + email: + enabled: true + from: 'postmaster@example.com' + to: 'recipient@bar.com' + method: sendmail + + E-Mail via GMail SMTP --------------------- diff --git a/lib/urlwatch/mailer.py b/lib/urlwatch/mailer.py index 2dc74cc8..3027e3fd 100644 --- a/lib/urlwatch/mailer.py +++ b/lib/urlwatch/mailer.py @@ -112,7 +112,7 @@ def __init__(self, sendmail_path): self.sendmail_path = sendmail_path def send(self, msg): - p = subprocess.Popen([self.sendmail_path, '-oi', '-f', msg['From'], msg['To']], + p = subprocess.Popen([self.sendmail_path, '-oi', '-f', msg['From']] + msg['To'].split(','), stdin=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)