
On 2025-03-10 9:35 p.m., Kyle Lahnakoski wrote:
On 2025-03-10 12:22 a.m., Stephen J. Turnbull wrote:
Alternatively, using the 'LMTP' class from 'smtplib' your Python script is almost a one-liner. You get the intended recipient from 'Delivered-To' (if it exists, if not life is considerably more complex), the sender from 'Sender' or 'From', and just pass that on to the LMTP object's send method to send to localhost:8024 (assuming the default port).
Thank you, I will try that next. It seems simple injection of the *-request@... emails into the mailist has no effect.
... and that WORKED! thank you!
def send(file): content = file.read() recipient_email, sender_email = get_emails(content) if not recipient_email: return with smtplib.LMTP(config.lmtp.host, config.lmtp.port) as lmtp: lmtp.sendmail(sender_email, [recipient_email], content)