diff --git a/docs/courier-to-mailman3.md b/docs/courier-to-mailman3.md index 57b406d..5971248 100644 --- a/docs/courier-to-mailman3.md +++ b/docs/courier-to-mailman3.md @@ -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? * I see... * The parsing of the environment variables is failing, but let's try this. -* That's not doing it... Might need to create users? \ No newline at end of file +* That's not doing it... Might need to create users? +* OK, let's see if what I need is in the headers... \ No newline at end of file diff --git a/source/courier-to-mailman3.py b/source/courier-to-mailman3.py index 8af5c3e..550943f 100644 --- a/source/courier-to-mailman3.py +++ b/source/courier-to-mailman3.py @@ -26,6 +26,7 @@ try: import os import sys import smtplib + from email.parser import HeaderParser logger.info('Starting Logging (inside try)') @@ -44,7 +45,10 @@ try: # "Line too long (see RFC5321 4.5.3.1.6)" # https://gitlab.com/mailman/mailman/-/issues/1133 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 # for qmail command docs and supplied environment variables. @@ -55,7 +59,7 @@ try: logger.info('EXT4: %s', os.environ['EXT2']) logger.info('EXT3: %s', os.environ['EXT3']) 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 = arg_ext_tmp if arg_ext_tmp != "1" else "" lmtp.sendmail(