first working implementation
This commit is contained in:
26
altermime.py
Normal file
26
altermime.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
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)
|
||||||
Reference in New Issue
Block a user