Users.messages: import

Requires authorization

Imports a message into only this user's mailbox, with standard email delivery scanning and classification similar to receiving via SMTP. Does not send a message. Try it now.

This method supports an /upload URI and accepts uploaded media with the following characteristics:

  • Maximum file size: 50MB
  • Accepted Media MIME types: message/rfc822

Request

HTTP request

This method provides media upload functionality through two separate URIs. For more details, see the document on media upload.

  • Upload URI, for media upload requests:
    POST https://www.googleapis.com/upload/gmail/v1/users/userId/messages/import
  • Metadata URI, for metadata-only requests:
    POST https://www.googleapis.com/gmail/v1/users/userId/messages/import

Parameters

Parameter name Value Description
Path parameters
userId string The user's email address. The special value me can be used to indicate the authenticated user.
Required query parameters
uploadType string The type of upload request to the /upload URI. Acceptable values are:
  • media - Simple upload. Upload the media only, without any metadata.
  • multipart - Multipart upload. Upload both the media and its metadata, in a single request.
  • resumable - Resumable upload. Upload the file in a resumable fashion, using a series of at least two requests where the first request includes the metadata.
Optional query parameters
deleted boolean Mark the email as permanently deleted (not TRASH) and only visible in Google Vault to a Vault administrator. Only used for G Suite accounts. (Default: false)
internalDateSource string Source for Gmail's internal date of the message.

Acceptable values are:
  • "dateHeader": The internal message time is based on the Date header in the email, when valid. (default)
  • "receivedTime": The internal message date is set to the time the message is received by Gmail.
neverMarkSpam boolean Ignore the Gmail spam classifier decision and never mark this email as SPAM in the mailbox. (Default: false)
processForCalendar boolean Process calendar invites in the email and add any extracted meetings to the Google Calendar for this user. (Default: false)

Authorization

This request requires authorization with at least one of the following scopes (read more about authentication and authorization).

Scope
https://mail.google.com/
https://www.googleapis.com/auth/gmail.modify
https://www.googleapis.com/auth/gmail.insert

Request body

In the request body, supply a Users.messages resource as the metadata. For more information, see the document on media upload.

Response

If successful, this method returns a Users.messages resource in the response body.

Try it!

Note: APIs Explorer currently supports metadata requests only.

Use the APIs Explorer below to call this method on live data and see the response.

Enviar comentarios sobre…

¿Necesitas ayuda? Visita nuestra página de asistencia.