Module gmail_push
Expand description
Gmail Pub/Sub push notification channel.
Structs§
- Gmail
Message - Full message returned by
GET /gmail/v1/users/me/messages/{id}. - Gmail
Notification - The decoded payload inside
PubSubMessage.data. - Gmail
Push Channel - Gmail
Push Config - History
Record - A single history record containing messages added to the mailbox.
- History
Response - Response from
GET /gmail/v1/users/me/history. - Message
Added - Wrapper for a newly added message reference.
- Message
Body - Message body with optional base64-encoded data.
- Message
Header - A single email header (name/value pair).
- Message
Part - A MIME part of a multipart message.
- Message
Payload - Message payload with headers and parts.
- Message
Ref - Minimal message reference returned by the history API.
- PubSub
Envelope - The outer JSON envelope that Google Pub/Sub POSTs to the push endpoint.
- PubSub
Message - A single Pub/Sub message inside the envelope.
- Watch
Response - Response from
POST /gmail/v1/users/me/watch.
Functions§
- extract_
body_ text - Extract the plain-text body from a Gmail message.
Walks MIME parts looking for
text/plain; falls back totext/htmlwith basic tag stripping; finally falls back to thesnippet. - extract_
email_ from_ header - Extract the plain email address from a
Fromheader value like"Name <email@example.com>". - extract_
header - Extract a header value from a Gmail message by name.
- parse_
notification - Parse and decode the Gmail notification from a Pub/Sub message.
- sanitize_
header_ value - Sanitize a string for use in an RFC 2822 header value. Removes CR and LF characters to prevent header injection attacks.