Skip to content

Gmail send: From header missing display name for consumer OAuth accounts (v0.11.0) #431

@moeedahmed

Description

@moeedahmed

Description

PR #184 (fixing #182) resolved the display name issue for service-account impersonation, but consumer OAuth accounts are still affected. Issue #243 was closed referencing #184, but that fix doesn't cover the consumer OAuth code path.

Steps to Reproduce

$ gog --version
v0.11.0 (91c4c15 2026-02-15T03:29:18Z)

# People API has the display name
$ gog people me --json | jq '.person.names[0].displayName'
"Moeed Ahmed"

# But primary SendAs entry has NO displayName field
$ gog gmail sendas get drmoeedahmed@gmail.com --json
{
  "sendAs": {
    "isDefault": true,
    "isPrimary": true,
    "sendAsEmail": "drmoeedahmed@gmail.com"
  }
}
# Note: no displayName key at all

# Send an email
$ gog gmail send --to test@example.com --subject "Test" --body "Test" --force
# Recipient sees From: drmoeedahmed@gmail.com (no name)

Root Cause

For consumer Gmail accounts (@gmail.com), the Gmail API's SendAs.Get and SendAs.List both return no displayName field for the primary address. The fix in #184 falls back from SendAs.GetSendAs.List, but the list also has no name for the primary entry.

The People API (people/me) does return the correct display name. The fallback chain should be:

  1. SendAs.Get → displayName
  2. SendAs.List → displayName (current fallback from fix(gmail): fallback to send-as list for display name #184)
  3. People.Get('people/me') → names[0].displayName ← missing step

Proof Gmail Accepts Explicit From Headers

Sending via the raw Gmail API with an explicit From: Dr Moeed Ahmed <drmoeedahmed@gmail.com> header in the RFC 2822 message works correctly — Gmail accepts and honours the display name. This confirms the issue is client-side (gog not setting the header), not a Gmail API limitation.

Expected

From: Moeed Ahmed <drmoeedahmed@gmail.com>

Actual

From: drmoeedahmed@gmail.com

Environment

  • gog v0.11.0 (91c4c15 2026-02-15)
  • Linux x86_64 (WSL2 Ubuntu)
  • Consumer Gmail account (not Google Workspace)
  • OAuth authentication (not service account)
  • People API accessible and returns correct displayName

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions