{"record":{"id":"b924a6be62964a3d","repo":"different-ai/openwork","slug":"resend-rejected","errorCode":"resend_rejected","errorMessage":"[${input.template}] email for ${input.recipient} failed: ${input.reason}${input.detail ? ` (${input.detail})` : \"\"}","messagePattern":"\\[(.+?)\\] email for (.+?) failed: (.+?)(.+?)\\)` : \"\"\\}","errorType":"exception","errorClass":"EmailSendError","httpStatus":null,"severity":"error","filePath":"packages/email/src/send-email.ts","lineNumber":138,"sourceCode":"      template: input.template,\n      recipient: input.to,\n      detail: \"Resend transactional email requires EMAIL_FROM and RESEND_API_KEY\",\n    })\n  }\n\n  try {\n    const resend = new Resend(apiKey)\n    const result = await resend.emails.send({\n      from,\n      to: input.to,\n      subject: input.subject,\n      replyTo: input.replyTo,\n      html: input.html,\n      text: input.text,\n    })\n\n    if (result.error) {\n      throw new EmailSendError({\n        template: input.template,\n        reason: \"resend_rejected\",\n        recipient: input.to,\n        detail: result.error.message,\n      })\n    }\n  } catch (error) {\n    if (error instanceof EmailSendError) {\n      throw error\n    }\n    const message = error instanceof Error ? error.message : \"Unknown error\"\n    throw new EmailSendError({ template: input.template, reason: \"resend_network\", recipient: input.to, detail: message })\n  }\n}\n\nasync function sendViaNodemailer(input: {\n  to: string\n  subject: string","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/packages/email/src/send-email.ts#L120-L156","documentation":"sendViaResend wraps a rejection from the Resend API in EmailSendError with reason \"resend_rejected\". result.error is set by the Resend SDK when the API accepted the request but refused to send (invalid recipient, rejected domain, quota, etc.). The detail field carries Resend's own error message.","triggerScenarios":"Calling sendEmail (routed to the Resend provider) and Resend returns result.error — e.g. unverified sender domain, invalid 'to' address, API key lacking permission, or rate/billing limits.","commonSituations":"Sending from a domain not verified in Resend; using a sandbox 'onboarding@resend.dev' sender to arbitrary recipients; malformed or role-based recipient addresses; exhausted Resend plan limits; revoked or wrong-scope API key.","solutions":["Read the detail message in the thrown EmailSendError — it contains Resend's specific rejection reason","Verify your sending domain in the Resend dashboard and use a from address on that domain","Check the Resend API key is valid, active, and has send permission","Confirm the recipient address is valid and within Resend's allowance (e.g. verified recipient in sandbox mode)","Check Resend account limits/billing if the error indicates rate or quota issues"],"exampleFix":"// before\nawait sendEmail({ template: 'invite', to: 'user@example.com', from: 'me@mydomain.com' }) // domain unverified\n// after — verify mydomain.com in Resend first, or use an allowed test sender\nawait sendEmail({ template: 'invite', to: 'user@example.com', from: 'hello@verified-mydomain.com' })","handlingStrategy":"try-catch","validationCode":"function validateResendSend({ to, from }) {\n  if (!/^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$/.test(to)) throw new Error(`Invalid recipient: ${to}`);\n  if (!from.endsWith('@your-verified-domain.com')) throw new Error(`Sender domain not verified in Resend: ${from}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await sendEmail({ template, to, from })\n} catch (e) {\n  if (e instanceof EmailSendError && e.reason === 'resend_rejected') {\n    console.error(`Resend rejected (${e.detail}) — check domain verification, API key, and recipient`)\n  } else throw e\n}","preventionTips":["Verify your sending domain in Resend before sending","Use a from address on a verified domain","Keep the Resend API key valid and scoped to send access","Validate recipient addresses before calling sendEmail","Monitor Resend quota/limits"],"tags":["email","resend","api-rejection","third-party"],"backgroundTag":"email-send-failed","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}