Parsing port number, and setting default if not set

This cleans a bit up, but not sure if this will get things working.
This commit is contained in:
Jigme Datse Yli-Rasku 2024-05-29 23:03:16 -07:00
parent b1ada80361
commit de3f954950
2 changed files with 7 additions and 5 deletions

View File

@ -28,3 +28,4 @@ This is our current version trying to communicate between courier and mailman3.
* Format had errors with `$` used instead of `%`
* Clean up logging to not log what was logged for logging diagnostics.
* Logging host and port on same line.
* OK, parsing port number, and setting default.

View File

@ -31,11 +31,12 @@ try:
# Setup LTMP connection
lmtp_host = sys.argv[3] if len(sys.argv) > 3 else 'localhost'
logger.info('lmtp_host: %s lmtp_port: %s', lmtp_host, sysv.arg[1])
lmtp_port = sys.argv[1] if len(sys.argv) > 1 else 8024
logger.info('lmtp_host: %s lmtp_port: %s', lmtp_host, lmtp_port)
# class smtplib.LMTP(host='', port=LMTP_PORT, local_hostname=None, source_address=None)
logger.info('lmtp_port: %s', sysv.arg[1])
lmtp = smtplib.LMTP(lmtp_host, int(sys.argv[1]))
logger.info('lmtp_port (lmtp setup): %s', sysv.arg[1])
logger.info('lmtp_port: %s', lmtp_port)
lmtp = smtplib.LMTP(lmtp_host, int(lmtp_port))
logger.info('lmtp_port (lmtp setup): %s', lmpt_port)
try:
# Unfortunately qmail sends to local bare LF for end line, while