fix(smtp): close the raw email stream when a relay does not send it (#423)

relayEmail opens a read stream on the .eml file for every relay, and only
client.send() ever consumed it. When the auto-relay rules left no
recipients, or the outgoing server failed the send (e.g. rejected a
recipient), the stream was never read or destroyed and its file
descriptor stayed open. Destroy it on the early return and in the finally
block; after a successful send it is already fully read, so that is a
no-op.
This commit is contained in:
dualfroz committed 2026-10-02 15:57:49 +02:00
1 parent 27e7633a30
commit 5479067fab
3 files changed
+78 -2

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
---
'@maildev/smtp': patch
'maildev': patch
---
Close the raw `.eml` stream when a relay does not send it (#423). Every relay
that ended without sending (no recipients left after the auto-relay rules, or
an error from the outgoing server) kept one file descriptor open, so a
long-running instance eventually hit the descriptor limit and auto-relay
stopped working.