Do we have useful headers

I'm not sure.
This commit is contained in:
Jigme Datse Yli-Rasku 2024-05-30 00:40:35 -07:00
parent 9d874c545a
commit d26983f25a
2 changed files with 8 additions and 3 deletions

View File

@ -38,4 +38,5 @@ This is our current version trying to communicate between courier and mailman3.
* OK, it's failing further along, so maybe this works? * OK, it's failing further along, so maybe this works?
* I see... * I see...
* The parsing of the environment variables is failing, but let's try this. * The parsing of the environment variables is failing, but let's try this.
* That's not doing it... Might need to create users? * That's not doing it... Might need to create users?
* OK, let's see if what I need is in the headers...

View File

@ -26,6 +26,7 @@ try:
import os import os
import sys import sys
import smtplib import smtplib
from email.parser import HeaderParser
logger.info('Starting Logging (inside try)') logger.info('Starting Logging (inside try)')
@ -44,7 +45,10 @@ try:
# "Line too long (see RFC5321 4.5.3.1.6)" # "Line too long (see RFC5321 4.5.3.1.6)"
# https://gitlab.com/mailman/mailman/-/issues/1133 # https://gitlab.com/mailman/mailman/-/issues/1133
content = sys.stdin.buffer.read() content = sys.stdin.buffer.read()
content = content.replace(b'\r\n', b'\n').replace(b'\r', b'\n').replace(b'\n', b'\r\n') #content = content.replace(b'\r\n', b'\n').replace(b'\r', b'\n').replace(b'\n', b'\r\n')
header = content.strip()
headers = HeaderParser(),parsestr(header)
pprint(dict(headers))
# See <https://qmail.notqmail.org/qmail-manual-html/man8/qmail-command.html> # See <https://qmail.notqmail.org/qmail-manual-html/man8/qmail-command.html>
# for qmail command docs and supplied environment variables. # for qmail command docs and supplied environment variables.
@ -55,7 +59,7 @@ try:
logger.info('EXT4: %s', os.environ['EXT2']) logger.info('EXT4: %s', os.environ['EXT2'])
logger.info('EXT3: %s', os.environ['EXT3']) logger.info('EXT3: %s', os.environ['EXT3'])
logger.info('EXT2: %s', os.environ['EXT4']) logger.info('EXT2: %s', os.environ['EXT4'])
logger.info('DEFAULT: %s', os.enviorn['DEFAULT']) logger.info('DEFAULT: %s', os.environ['DEFAULT'])
arg_ext_tmp = sys.argv[2] if len(sys.argv) > 2 else "1" arg_ext_tmp = sys.argv[2] if len(sys.argv) > 2 else "1"
arg_ext = arg_ext_tmp if arg_ext_tmp != "1" else "" arg_ext = arg_ext_tmp if arg_ext_tmp != "1" else ""
lmtp.sendmail( lmtp.sendmail(