From 1d2aa6570974ba4c11f3b9dfc4e3acaae6f6d05d Mon Sep 17 00:00:00 2001 From: "sergey.muhlynin@makeup.com.ua" Date: Tue, 10 Sep 2024 14:04:32 +0300 Subject: [PATCH] feat: Added handle_HELO to process non-standard communication as extended SMTP - Modified smtp2mqtt.py to handle HELO from devices with non-RFC compliant behavior. - Updated to ensure compatibility with DVR Slinex GL-08N, which sends non-standard SMTP commands. --- smtp2mqtt/smtp2mqtt.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/smtp2mqtt/smtp2mqtt.py b/smtp2mqtt/smtp2mqtt.py index 942dabc..c4329f5 100644 --- a/smtp2mqtt/smtp2mqtt.py +++ b/smtp2mqtt/smtp2mqtt.py @@ -146,6 +146,13 @@ async def handle_DATA(self, server, session, envelope): # done! return "250 Message accepted for delivery" + async def handle_HELO(self, server, session, envelope, hostname): + # Set extended SMTP (ESMTP) + session.extended_smtp = True + log.debug(f"HELO received from {hostname}, extended SMTP enabled", extra={'uuid': 'main thread'}) + session.host_name = hostname + return '250 {}'.format(server.hostname) + def mqtt_publish(self, topic, payload, log_extra): if config["DEBUG"]: if (log.isEnabledFor(logging.DEBUG)): log.debug('Publishing [%s] to %s', payload, topic, extra=log_extra)