-
Notifications
You must be signed in to change notification settings - Fork 138
Open
Description
Problem
When sending emails programmatically via gog gmail send, there's no way to include the user's Gmail signature. This means emails sent by AI agents/scripts look different from emails sent via Gmail UI, which can appear unprofessional or inconsistent.
Proposed Solution
Add a --signature flag that appends the user's Gmail signature to outgoing emails.
Options:
--signature(no value) - Fetch and append the user's default Gmail signature from Gmail API--signature=<name>- Fetch a specific named signature (Gmail supports multiple)--signature-file=<path>- Append signature from a local file (for offline/custom signatures)
Gmail API Reference
Signatures are stored in users.settings.sendAs resource:
GET https://gmail.googleapis.com/gmail/v1/users/me/settings/sendAs/{sendAsEmail}
Response includes signature field (HTML string).
LLM Implementation Prompt
Add a --signature flag to the gmail send command in gog.
Requirements:
1. Add three new flags to gmail send:
- --signature (bool): When true, fetch the default signature from Gmail API and append to email body
- --signature-name (string): Fetch a specific named signature from send-as aliases
- --signature-file (string): Read signature from local file path
2. Signature fetching logic:
- Call Gmail API: GET /gmail/v1/users/me/settings/sendAs/{fromEmail}
- Extract the "signature" field (HTML string)
- If --body is used (plain text), convert HTML signature to plain text before appending
- If --body-html is used, append HTML signature directly
3. Signature insertion:
- Add two newlines before signature
- For plain text: prepend with "--\n" (standard email signature delimiter)
- For HTML: wrap in <div class="gmail_signature"> for consistency
4. Error handling:
- If signature is empty/not set, warn but don't fail
- If --signature-file path doesn't exist, error with clear message
5. Update help text to document the new flags
Files to modify:
- cmd/gmail/send.go (add flags and logic)
- pkg/gmail/client.go (add GetSignature method if needed)
Use Case
AI agents sending emails on behalf of users need signature parity with manual emails. Currently I have to either:
- Skip signatures (looks incomplete)
- Hardcode signatures in prompts (maintenance burden, gets stale)
- Manually fetch from a sent email and append (tedious)
Priority
Medium - quality of life improvement for automation workflows
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels