{"record":{"id":"7434529498c1ae8e","repo":"nextauthjs/next-auth","slug":"email-failed-join-could-not-be-sent","errorCode":null,"errorMessage":"Email (${failed.join(\", \")}) could not be sent","messagePattern":"Email \\((.+?)\\) could not be sent","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/providers/nodemailer.ts","lineNumber":79,"sourceCode":"    server: { host: \"localhost\", port: 25, auth: { user: \"\", pass: \"\" } },\n    from: \"Auth.js <no-reply@authjs.dev>\",\n    maxAge: 24 * 60 * 60,\n    async sendVerificationRequest(params) {\n      const { identifier, url, provider, theme } = params\n      const { host } = new URL(url)\n      const transport = createTransport(provider.server)\n      const result = await transport.sendMail({\n        to: identifier,\n        from: provider.from,\n        subject: `Sign in to ${host}`,\n        text: text({ url, host }),\n        html: html({ url, host, theme }),\n      })\n      const rejected = result.rejected || []\n      const pending = result.pending || []\n      const failed = rejected.concat(pending).filter(Boolean)\n      if (failed.length) {\n        throw new Error(`Email (${failed.join(\", \")}) could not be sent`)\n      }\n    },\n    options: config,\n  }\n}\n","sourceCodeStart":61,"sourceCodeEnd":85,"githubUrl":"https://github.com/nextauthjs/next-auth/blob/a1a16a5a7780488c7449feece410033f445d0b31/packages/core/src/providers/nodemailer.ts#L61-L85","documentation":"After transport.sendMail resolves, the provider inspects result.rejected and result.pending; if any recipient addresses were rejected or left pending, it throws this Error listing them. Nodemailer accepted the message for some recipients but the SMTP server refused others, so the verification email did not reach the user and sign-in fails.","triggerScenarios":"transport.sendMail({ to, subject, text, html }) returns a result where rejected.concat(pending).filter(Boolean).length > 0 — e.g. the SMTP server rejects the recipient address (550 no such user, greylisting placing it in pending, spam policy refusal). Any non-empty failed list triggers the throw with the addresses joined by commas.","commonSituations":"Typo'd or disposable email addresses submitted on the sign-in form; corporate SMTP rejecting external recipients; self-hosted SMTP with strict recipient validation; greylisting providers returning the recipient as pending.","solutions":["Check the listed addresses in the error — verify the user typed a valid, deliverable email","Review your SMTP server logs for the corresponding rejection reason (550/551/greylist)","If greylisting causes pending entries, configure your SMTP server or retry the send after a delay","Test with a known-good recipient to confirm the transport itself is healthy"],"exampleFix":"// before\n// spam filter rejects recipients silently at SMTP level -> throw\nserver: { host: \"smtp.example.com\", port: 25 }\n// after\nserver: { host: \"smtp.example.com\", port: 587, auth: {...} }\n// plus: validate the identifier is a syntactically valid email before calling signIn,\n// and catch this error in the sign-in flow to show a user-friendly message","handlingStrategy":"try-catch","validationCode":"// validate the submitted identifier before triggering signIn\nconst emailOk = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(identifier)\nif (!emailOk) return rejectSignIn('Please enter a valid email address')","typeGuard":"function wasFullyAccepted(r: { rejected?: string[]; pending?: string[]; accepted?: string[] }): boolean {\n  return (r.rejected?.length ?? 0) === 0 && (r.pending?.length ?? 0) === 0\n}","tryCatchPattern":"try {\n  await sendVerificationRequest(params)\n} catch (e) {\n  const m = e instanceof Error ? e.message : ''\n  const failed = m.match(/Email \\((.+)\\) could not be sent/)?.[1]\n  console.error(`SMTP rejected recipients: ${failed} — check SMTP server logs`)\n  // return a neutral message to the user; do not reveal whether the address exists\n}","preventionTips":["Validate email syntax on the sign-in form before calling signIn","Check SMTP server logs for 550/55x rejection codes for the listed addresses","Use port 587 with proper auth rather than unauthenticated port 25, which many servers restrict","Account for greylisting: pending recipients may succeed on retry after a delay"],"tags":["email","smtp","nodemailer","recipient-rejected"],"backgroundTag":"email-recipient-rejected","analyzedSha":"a1a16a5a7780488c7449feece410033f445d0b31","analyzedAt":"2026-08-28T21:52:38.200Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}