diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2020-05-26 22:36:19 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2020-05-27 16:04:14 +0300 |
commit | 5c406d9fd9d815d8b6869474146a2754bfcd5157 (patch) | |
tree | a2422dfd7de3a5824a58b16501b5cfa507725a08 | |
parent | b155c6f4a5ac611f109ee814d348a282b006478c (diff) |
Try to send email to Bcc: list, even if To: is empty
Also log sendmail exit status
-rw-r--r-- | calm/buffering_smtp_handler.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/calm/buffering_smtp_handler.py b/calm/buffering_smtp_handler.py index fcc5290..c826d34 100644 --- a/calm/buffering_smtp_handler.py +++ b/calm/buffering_smtp_handler.py @@ -84,12 +84,12 @@ class BufferingSMTPHandler(logging.handlers.BufferingHandler): print('-' * 40) print(msg) print('-' * 40) - elif len(self.toaddrs) > 0: + else: with subprocess.Popen(['/usr/sbin/sendmail', '-t', '-oi', '-f', self.fromaddr], stdin=subprocess.PIPE) as p: p.communicate(m.as_bytes()) + logging.debug('sendmail: msgid %s, exit status %d' % (m['Message-Id'], p.returncode)) self.buffer = [] - logging.debug('sent mail with msgid %s' % (m['Message-Id'])) def shouldFlush(self, record): # the capacity we pass to BufferingHandler is irrelevant since we |