27 lines
786 B
Python
27 lines
786 B
Python
import subprocess
|
|
import sys
|
|
|
|
# disclaimer file
|
|
DISCLAIMER = "/etc/postfix/disclaimers/generic"
|
|
|
|
# Exit codes from <sysexits.h>
|
|
EX_UNAVAILABLE = 69
|
|
|
|
am = subprocess.run(["/usr/bin/altermime",
|
|
"--input=-",
|
|
f"--disclaimer={DISCLAIMER}",
|
|
f"--htmltoo",
|
|
"--force-for-bad-html",
|
|
#"--xheader='blablubb'",
|
|
],
|
|
stdin=sys.stdin,
|
|
capture_output=True)
|
|
|
|
if am.returncode > 0:
|
|
sys.exit(EX_UNAVAILABLE)
|
|
|
|
sendmailprocess = subprocess.Popen(["./sendmail"] + sys.argv[1:], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
sendmailprocess.communicate(input=am.stdout)
|
|
|
|
sys.exit(0)
|