gmail.users.messages.import
Imports an email message directly into a user's Gmail mailbox for delivery-style scanning and classification without sending it.
Instructions
Imports a message into only this user's mailbox, with standard email delivery scanning and classification similar to receiving via SMTP. This method doesn't perform SPF checks, so it might not work for some spam messages, such as those attempting to perform domain spoofing. This method does not send a message. Note that the maximum size of the message is 150 MB [HTTP POST] — creates or triggers a change; refused under --readonly safety profiles. Returns the API's response resource as JSON — request body is a JSON Message object accepting classificationLabelValues, historyId, id, internalDate, labelIds, payload, raw, sizeEstimate and 2 more fields; pass it via params or whole via body_file Siblings over the same resource: batchDelete, batchModify, delete, get, insert, list, modify, send, trash, untrash.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | Extra KEY=VALUE query pairs for endpoints whose parameters Discovery does not describe. | |
| params | No | Parameter map merged into the request; typed parameters win. | |
| userId | Yes | [URL path segment] The user's email address. The special value `me` can be used to indicate the authenticated user. | me |
| deleted | No | [query parameter] Mark the email as permanently deleted (not TRASH) and only visible in Google Vault to a Vault administrator. Only used for Google Workspace accounts. | false |
| dry_run | No | Return the request that would be sent, without sending it. | |
| body_file | No | Read the request body from this file ('-' for stdin) instead of building one from the parameters. The body is a JSON Message object. | |
| request_body | No | Request body of type Message: pass it via `params` (merged into the built body) or whole via `body_file`. | |
| neverMarkSpam | No | [query parameter] Ignore the Gmail spam classifier decision and never mark this email as SPAM in the mailbox. | false |
| internalDateSource | No | [query parameter] Source for Gmail's internal date of the message. Values: `receivedTime` = Internal message date set to current time when received by Gmail.; `dateHeader` = Internal message time based on 'Date' header in email, when valid.. | dateHeader |
| processForCalendar | No | [query parameter] Process calendar invites in the email and add any extracted meetings to the Google Calendar for this user. | false |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | ||
| raw | No | ||
| payload | No | ||
| snippet | No | ||
| labelIds | No | ||
| threadId | No | ||
| historyId | No | ||
| internalDate | No | ||
| sizeEstimate | No | ||
| classificationLabelValues | No |