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)}$`) );