comments, fix sendmail path
This commit is contained in:
19
altermime.py
19
altermime.py
@@ -1,3 +1,14 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
"""
|
||||||
|
Python reimplementation of the here shown bash script:
|
||||||
|
https://dukun.de/xox/altermime/postfix-altermime-howto-2.html
|
||||||
|
|
||||||
|
Use at your own risk, comes without warranty.
|
||||||
|
|
||||||
|
License: GPLv3
|
||||||
|
Author: Georg Schlisio
|
||||||
|
"""
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@@ -10,9 +21,9 @@ EX_UNAVAILABLE = 69
|
|||||||
am = subprocess.run(["/usr/bin/altermime",
|
am = subprocess.run(["/usr/bin/altermime",
|
||||||
"--input=-",
|
"--input=-",
|
||||||
f"--disclaimer={DISCLAIMER}",
|
f"--disclaimer={DISCLAIMER}",
|
||||||
f"--htmltoo",
|
"--htmltoo",
|
||||||
"--force-for-bad-html",
|
"--force-for-bad-html",
|
||||||
#"--xheader='blablubb'",
|
#"--xheader='blablubb'", # example of how to add arbitrary header
|
||||||
],
|
],
|
||||||
stdin=sys.stdin,
|
stdin=sys.stdin,
|
||||||
capture_output=True)
|
capture_output=True)
|
||||||
@@ -20,7 +31,5 @@ am = subprocess.run(["/usr/bin/altermime",
|
|||||||
if am.returncode > 0:
|
if am.returncode > 0:
|
||||||
sys.exit(EX_UNAVAILABLE)
|
sys.exit(EX_UNAVAILABLE)
|
||||||
|
|
||||||
sendmailprocess = subprocess.Popen(["./sendmail"] + sys.argv[1:], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
|
sendmailprocess = subprocess.Popen(["/usr/bin/sendmail"] + sys.argv[1:], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
sendmailprocess.communicate(input=am.stdout)
|
sendmailprocess.communicate(input=am.stdout)
|
||||||
|
|
||||||
sys.exit(0)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user