From 640fbef2006c9a04af23c6232a86b8da4cbebbe8 Mon Sep 17 00:00:00 2001 From: Leandro Facchinetti Date: Mon, 7 Dec 2020 22:56:00 +0000 Subject: [PATCH] Close #31 --- index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 71d3715..8a6b56c 100644 --- a/index.ts +++ b/index.ts @@ -89,7 +89,9 @@ export const emailServer = new SMTPServer({ const email = await mailparser.simpleParser(stream); const content = typeof email.html === "string" ? email.html : email.textAsHtml ?? ""; - for (const { address } of session.envelope.rcptTo) { + for (const address of new Set( + session.envelope.rcptTo.map(({ address }) => address) + )) { const match = address.match( new RegExp(`^(?\\w+)@${R(EMAIL_DOMAIN)}$`) );