Conversation
… primary Gmail returns an empty send-as displayName for a primary address whose name comes from the account. resolve_sender wrote that identity as an explicit bare From, which Gmail delivers verbatim, so recipients saw only the address. Omit the header in that case so Gmail stamps the account's own "Name <address>", as its web client does. Nameless non-primary aliases and explicit --from are unchanged. Fixes googleworkspace#644
🦋 Changeset detectedLatest commit: f329855 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Author
|
@googleworkspace-bot recheck |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #644 for the common case.
Every mail helper (
+send,+reply,+reply-all,+forward, and--draft) resolves its From header inresolve_sender. When no--fromis given, it listssettings.sendAsand uses the default identity. For an ordinary account, Gmail returns that identity as the primary address with an emptydisplayName, because the name comes from the Google account or directory profile.resolve_senderthen wrote an explicit bareFrom: <user@example.com>. Gmail delivers an explicit From exactly as written, so recipients see only the address. The People API fallback only helps when theprofilescope is granted and the People API is enabled in the GCP project, which is why #644 still reproduces with the scope granted (see also #684).With this change, when the default identity is the primary address and has no display name,
resolve_senderreturns no From. Gmail then stamps the account's ownName <address>, as the Gmail web client does. No extra scope or API is needed, and the People API request is no longer made on this path.What stays the same:
From: Name <address>.--fromis unchanged. Bare addresses are still enriched from sendAs.isPrimaryis treated as non-primary, so it keeps the previous behavior.Verified against real Gmail: a message sent through
users.messages.sendwith no From header was delivered asFrom: <Account Name> <address>.Dry Run Output: not applicable (no request-schema change).
Checklist:
AGENTS.mdguidelines (no generatedgoogle-*crates).cargo fmt --allto format the code perfectly.cargo clippy -- -D warningsand resolved all warnings.pnpx changeset) to document my changes.