Skip to content

fix(email): don't send from auth@undefined and report when email isn't configured - #3003

Open
07rjain wants to merge 1 commit into
CapSoftware:mainfrom
07rjain:split/email-delivery-status
Open

07rjain wants to merge 1 commit into
CapSoftware:mainfrom
07rjain:split/email-delivery-status

Conversation

@07rjain

@07rjain 07rjain commented Oct 23, 2026 •

Copy link
Copy Markdown

Split out of #2580 (email delivery status).

  • Self-hosts with RESEND_API_KEY but no RESEND_FROM_DOMAIN sent from auth@undefined. Resend rejects that, but the UI still said a code was sent.
  • getEmailDeliveryStatus() / sendEmail() now return email_not_configured when no usable sender exists. An explicit fromOverride still works without a default domain.
  • Resend rejections are logged and returned instead of reported as success.
  • Login codes go to the server log when email isn't configured, and the verify screen says "Email (Resend) is not configured".
  • Invite endpoints (web action, mobile, v1 API) report emailDelivery: "not_configured" instead of accepted. AgentOrganizationInviteResponse gains that literal.
  • Docs: Email Configuration section.

Tests. email-config.test.ts.

RetriggerView in GreptileConfidence Score: 4/5

The PR appears safe to merge, with two non-blocking messages that still claim skipped emails were sent.

Findings

  1. P2 Resend still promises an email ▶
  2. P2 Skipped invites look sent ▶
Fix with agent prompt
### Issue 1
apps/web/app/(org)/verify-otp/form.tsx:176-184
The new `emailDeliveryConfigured` flag fixes the page text, but the resend toast still says “A new code has been sent to your email!” when email is disabled. Requesting another code only prints it to the server logs. Use the flag in `handleResend.onSuccess` too, so users are not sent back to their inbox.

### Issue 2
apps/web/actions/organization/send-invites.ts:190-191
Excluding `email_not_configured` from `failedInvites` keeps the invite links usable, but it also leaves `failedEmails` empty. `InviteDialog` then shows “Invites sent successfully” without warning that no email was sent. Return a separate delivery status and show the skipped-email notice without deleting the invite records.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The PR stops self-hosted email from using auth@undefined and reports missing email settings.

  • Self-hosted email only sends with a usable sender.
  • Login screens point users to logs when email is off.
  • Invites stay usable when email is not configured.
  • Support request results reflect whether email was sent.

07rjain explicitly intends login codes to appear in server logs when email is not configured.

Reviews (1) · Last reviewed commit: "fix(email): never send from auth@undefin..." · Reviewed by Greptile

… and surface send failures

Self-hosts without RESEND_FROM_DOMAIN sent from auth@undefined, which Resend rejects, while the UI still said a code was sent. Email is now treated as configured only when the API key and sender are both available, login codes are logged otherwise, the verify screen says email is not configured, explicit fromOverride senders keep working without a default domain, and invite APIs report not_configured instead of accepted.
@vercel

vercel Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

@07rjain is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

Comment on lines +176 to +184
{emailDeliveryConfigured ? (
<p className="text-sm text-gray-10">
We sent a 6-digit code to {normalizedEmail}
</p>
) : (
<p className="text-sm text-gray-10">
Email (Resend) is not configured on this server. The 6-digit code
for {normalizedEmail} was printed to the server logs. Ask your
administrator, or set RESEND_API_KEY and RESEND_FROM_DOMAIN.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Resend still promises an email

The new emailDeliveryConfigured flag fixes the page text, but the resend toast still says “A new code has been sent to your email!” when email is disabled. Requesting another code only prints it to the server logs. Use the flag in handleResend.onSuccess too, so users are not sent back to their inbox.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/web/app/(org)/verify-otp/form.tsx
Line: 176-184

Comment:
**Resend still promises an email**

The new `emailDeliveryConfigured` flag fixes the page text, but the resend toast still says “A new code has been sent to your email!” when email is disabled. Requesting another code only prints it to the server logs. Use the flag in `handleResend.onSuccess` too, so users are not sent back to their inbox.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +190 to +191
const error = result.value?.error;
return Boolean(error && error.name !== "email_not_configured");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Skipped invites look sent

Excluding email_not_configured from failedInvites keeps the invite links usable, but it also leaves failedEmails empty. InviteDialog then shows “Invites sent successfully” without warning that no email was sent. Return a separate delivery status and show the skipped-email notice without deleting the invite records.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/web/actions/organization/send-invites.ts
Line: 190-191

Comment:
**Skipped invites look sent**

Excluding `email_not_configured` from `failedInvites` keeps the invite links usable, but it also leaves `failedEmails` empty. `InviteDialog` then shows “Invites sent successfully” without warning that no email was sent. Return a separate delivery status and show the skipped-email notice without deleting the invite records.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant