Skip to content

Commit d9ba378

Browse files
committed
first step: capture stderr of sendmail
and encode it into the Exception message.
1 parent 8bc2038 commit d9ba378

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

cmk/utils/mail.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ def send_mail_sendmail(m: Message, target: MailString, from_address: MailString
111111
target = MailString(",".join(list(filter(None, target.split(",")))))
112112
cmd += ["-i", target]
113113

114-
completed_process = subprocess.run(cmd, encoding="utf-8", check=False, input=m.as_string())
114+
completed_process = subprocess.run(cmd, encoding="utf-8", check=False, input=m.as_string(), capture_output=True)
115115

116116
if completed_process.returncode:
117-
raise RuntimeError("sendmail returned with exit code: %d" % completed_process.returncode)
117+
raise RuntimeError("sendmail returned with exit code: %d; %s; %s" % (completed_process.returncode, completed_process.stderr, completed_process.stdout))
118118

119119

120120
# duplicate from omdlib

0 commit comments

Comments
 (0)