diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/conf/py-sample/sample.jsonc | 4 | ||||
-rw-r--r-- | src/palhm/__init__.py | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/conf/py-sample/sample.jsonc b/src/conf/py-sample/sample.jsonc index 0004a28..b519fdf 100644 --- a/src/conf/py-sample/sample.jsonc +++ b/src/conf/py-sample/sample.jsonc @@ -7,7 +7,9 @@ // "mua": "stdout", "mua": "mailx", // "mua": "aws-sns", - // "mua-param": {}, + "mua-param": { + "int-opts": [ "smtp=localhost" ] + }, "mail-to": [ "root" ] // "subject": "Custom Boot Report Subject from {hostname}", // "header": "Custom header content with {hostname} substitution." diff --git a/src/palhm/__init__.py b/src/palhm/__init__.py index 79a6d3f..90de4fc 100644 --- a/src/palhm/__init__.py +++ b/src/palhm/__init__.py @@ -584,6 +584,7 @@ class MUA (ABC): class MailxMUA (MUA): def __init__ (self, jobj: dict): self.exec = jobj.get("exec", "/bin/mailx") + self.int_opts = jobj.get("int-opts", []) def __str__ (self) -> str: return '''mailx: @@ -595,7 +596,12 @@ class MailxMUA (MUA): recipients: Iterable[str], subject: str, composer: Iterable[str]) -> int: - argv = [ self.exec, "-s", subject ] + recipients + argv = [ self.exec ] + for i in self.int_opts: + argv.append("-S") + argv.append(i) + argv += [ "-s", subject ] + argv += recipients with subprocess.Popen( argv, |