Use Header "To" for recepient.

This might not quite work, but it's worth a go.
This commit is contained in:
Jigme Datse Yli-Rasku 2024-05-30 00:59:35 -07:00
parent d26983f25a
commit 41037b6507
1 changed files with 3 additions and 9 deletions

View File

@ -47,24 +47,18 @@ try:
content = sys.stdin.buffer.read()
#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))
headers = HeaderParser().parsestr(header.decode('utf-8'))
header_to = headers[To]
# See <https://qmail.notqmail.org/qmail-manual-html/man8/qmail-command.html>
# for qmail command docs and supplied environment variables.
# We need to replace "1" with an empty string, as qmail only supports EXT,
# EXT2, EXT3, EXT4.
logger.info('User: %s', os.environ['USER'])
logger.info('EXT: %s', os.environ['EXT'])
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.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(
os.environ['SENDER'],
os.environ['RECIPIENT'],
header_to,
#sys.stdin.buffer.read()
content
)