Skip to content

Support Gmail send-as identities and reply sender defaults - #156

Merged
stephenw310 merged 2 commits into
mainfrom
codex/gmail-send-as-identities
Sep 26, 2026
Merged

stephenw310 merged 2 commits into
mainfrom
codex/gmail-send-as-identities

Conversation

@stephenw310

@stephenw310 stephenw310 commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Attn currently sends only from the signed-in account's primary address. This change adds a From menu for verified Gmail “Send mail as” identities in new messages and inline replies, including external addresses configured through Gmail.

New messages use the cached Gmail default identity. Replies and forwards preserve an owned From address or match the source message's To, Cc, then Bcc addresses. If none match, they use the default identity. The initial signature follows that choice; manually changing From preserves the existing body and signature.

The selected identity survives autosave, restart, Gmail draft sync, undo-send, and send recovery. Outgoing messages use its display name and Reply-To. Replies exclude verified aliases from self-recipients. A revoked identity produces an error instead of silently switching senders.

The picker uses Attn's theme colors and supports keyboard navigation. Schema version 30 adds the sender address through an automatic migration that preserves existing drafts. Identity management and SMTP configuration remain in Gmail.

Validation

  • Full npm run verify passed: type checks, lint, 1,667 unit tests, production build, and 392 E2E tests.
  • Regression coverage verifies sender-only reply edits survive close and relaunch, and the first primary-address send uses the refreshed Reply-To.
  • All 11 sender E2E tests passed, including reply and forward identity defaults.
  • Inspected full and inline sender menus in light and dark themes.
  • Gmail behavior uses mocked providers and isolated profiles. No live Gmail send was tested.

The previously observed window-reopen focus test passed in this full run.

@stephenw310
stephenw310 marked this pull request as ready for review September 26, 2026 14:34
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-26T14:38:40.141620Z c71d506 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c71d506355

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/main/outbox/drafts.ts
Comment on lines +359 to +364
if (input.senderEmail !== undefined) {
db.prepare('UPDATE outbox SET sender_email = ? WHERE account_id = ? AND id = ?').run(
normalizeEmailKey(input.senderEmail) === normalizeEmailKey(accountId) ? null : input.senderEmail,
accountId,
id
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve sender-only reply edits on close

When a reply or reply-all has no user edit except choosing another From address, this stores sender_email and increments the revision, but shouldMirrorDraft still classifies the draft as untouched because isUntouchedThreadDraft ignores the sender and only interprets later revisions for forwards. Save & close therefore takes closeDraft's discarded branch, deleting the local row—and any mirrored Gmail draft—so the selected identity does not survive restart or draft sync.

Useful? React with 👍 / 👎.

Comment thread src/main/db/queries.ts
Comment on lines 845 to +846
fromName: 'Me',
fromEmail: account ?? accountId,
fromEmail: row.sender_email ?? account ?? accountId,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Treat confirmed alias messages as self-authored

For a reply or forward sent through an alias, the pending projection now carries the alias address while labeling it Me, but once Gmail's confirmed message replaces that projection, readConversation recognizes only the account's primary address as self-authored. The same message consequently changes from Me to the alias display name after synchronization; confirmed messages from cached send-as identities need the same self-address treatment.

Useful? React with 👍 / 👎.

Comment thread src/main/outbox/sender.ts Outdated
Comment on lines +518 to +522
const identity = resolveSendAs(this.db, row.account_id, senderEmail)
const accountName =
senderEmail === row.account_id
? await this.senderDisplayName(row.account_id, provider, signal)
: (identity.displayName ?? '')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Refresh the primary identity before reading Reply-To

On a fresh or upgraded profile without a cached sendAsIdentities value, resolveSendAs returns the synthesized primary identity without its configured Reply-To. senderDisplayName may then successfully refresh the full send-as list, but options.replyToAddress is still read from the stale object, so that first primary-address message omits the configured Reply-To and responses can go to the wrong mailbox. Resolve the identity again after the refresh, or refresh before resolving it.

Useful? React with 👍 / 👎.

@stephenw310
stephenw310 merged commit e7f50cc into main Sep 26, 2026
9 checks passed
@stephenw310
stephenw310 deleted the codex/gmail-send-as-identities branch September 26, 2026 23:08
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