Report Gmail thread as spam
Automatically report Gmail thread as spam on mail.google.com. Report a Gmail thread as spam by its hex threadId (moves it to Spam). Requires an authenticated mail.google.com session. Works from the All Mail list view, scanning the first 4 pages (~200 newest threads), and is locale-independent. Returns reportedSpam, threadId, and the page it was found on. Moving the thread to Spam also feeds Gmail's spam classifier for that sender, which undoing does not fully reverse. Pass `account` (authuser=) in a multi-account browser jar, or Gmail picks u/0 nondeterministically. Senders with an unsubscribe link raise an extra "Report spam or unsubscribe?" dialog; the script confirms the spam branch and rejects the unsubscribe one, and throws rather than guessing on an unrecognised dialog shape.
Input
threadId requiredHex thread id, as returned by list_inbox / search_emails.
account optionalGmail account address to act as (authuser pin). Omit for u/0.
Output
page requiredthreadId requiredreportedSpam 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 an optional single file attachment.
Get Gmail thread
Read a Gmail thread by its hex threadId (as returned by search_emails): subject plus every rendered message's from, fromEmail, to, date, plain-text body and attachment names. In long threads Gmail collapses older messages, so only rendered (expanded) messages are returned.
