diff --git a/packages/helpers/src/dkim/index.ts b/packages/helpers/src/dkim/index.ts index d3350589b..d3bc6ab28 100644 --- a/packages/helpers/src/dkim/index.ts +++ b/packages/helpers/src/dkim/index.ts @@ -20,6 +20,20 @@ export async function verifyDKIMSignature( domain: string = "", tryRevertARCChanges: boolean = true ): Promise { + + const emailStr = email.toString(); + + const pgpMarkers = [ + "BEGIN PGP MESSAGE", + "BEGIN PGP SIGNED MESSAGE", + "X-Pm-Content-Encryption: end-to-end", + ]; + + const isPGPEncoded = pgpMarkers.some(marker => emailStr.includes(marker)); + + if (isPGPEncoded) { + throw new Error("PGP encoded emails are not supported."); + } let dkimResult = await tryVerifyDKIM(email, domain); if (dkimResult.status.result !== "pass" && tryRevertARCChanges) {