diff options
| author | Barry Warsaw | 2016-02-25 17:05:26 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2016-02-25 17:05:26 -0500 |
| commit | a33cf78968fd73651054b0159f92e21a0aa6da61 (patch) | |
| tree | c3c27916b7ef47d2ecf23c179fb70da7480cea1b /contrib | |
| parent | 6a8cbd3b1f3fb7f3806eadb131700091d32a31b4 (diff) | |
| parent | 91a91411f48009a24ccc8951bda081ab61356cc6 (diff) | |
| download | mailman-a33cf78968fd73651054b0159f92e21a0aa6da61.tar.gz mailman-a33cf78968fd73651054b0159f92e21a0aa6da61.tar.zst mailman-a33cf78968fd73651054b0159f92e21a0aa6da61.zip | |
Diffstat (limited to 'contrib')
| -rwxr-xr-x | contrib/qmail-lmtp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/contrib/qmail-lmtp b/contrib/qmail-lmtp new file mode 100755 index 000000000..c6398f892 --- /dev/null +++ b/contrib/qmail-lmtp @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +# +# Written by Thomas Schneider <qsuscs@qsuscs.de> +# This script is placed in public domain. If this is not applicable, consider +# it licensed under the CC-0: +# <https://creativecommons.org/publicdomain/zero/1.0/> + +try: + import smtplib + import sys + import os + + lmtp = smtplib.LMTP("localhost", int(sys.argv[1])) + + try: + lmtp.sendmail( + os.environ['SENDER'], + os.environ['EXT' + sys.argv[2]] + "@" + os.environ['HOST'], + sys.stdin.buffer.read() + ) + except smtplib.SMTPResponseException as e: + if 400 <= e.smtp_code < 500: + exit(111) + # otherwise, it's either a 5xx aka permanent error or something else + # is already b0rked, thus raise -> exit(100) -> have qmail return a + # 5xx error + else: + raise +except: + exit(100) |
