Get Current Gmail User
Automatically get Current Gmail User on mail.google.com. Return the display name and email of the Gmail account this browser is signed in as.
Input
account optionalOptional Google account to report on, for a browser signed into several: its email address, or a bare mailbox index such as "2". Omit for the first account (u/0).
Output
name requiredemail requiredFAQ
Search Gmail
Search the signed-in Gmail with the native query syntax (from:, to:, subject:, has:attachment, after:/before:, labels…) and return matching threads: threadId (feed it to get_thread / reply_to_email), sender, senderEmail, subject, snippet, date, unread, starred, hasAttachment. Results are threads rather than individual messages, which is Gmail's own search granularity, and only the first page of results is returned (up to 50).
Send Gmail email
Send an email from the signed-in Gmail account, with a plain-text body and up to 10 file attachments in the same email (attachment, attachment2 ... attachment10; name them with attachmentNames). Returns every attachment's name as Gmail showed it before sending. Always starts a new conversation. To answer inside an existing thread, use mail.google.com/reply_to_email.
Create a Gmail draft
Compose a Gmail message and save it as a draft without sending it. Takes to/cc/bcc, a subject and a plain-text body, and can put one of the account's Gmail signatures under the body by its name, or none; without that choice the draft keeps Gmail's default signature for new emails. Reports success only once Gmail confirms the draft is saved under Drafts with that subject and body, and returns the account used, the draft id that update_draft and send_draft take, and the id of its conversation. Create drafts one after another on a browser: several at once can leave Gmail without saving some of them, which the call reports as an error.
