Method: users.messages.insert
IMAP APPEND
と同様に、ユーザーのメールボックスにのみメールを直接挿入し、ほとんどのスキャンと分類を回避します。メッセージは送信しません。
HTTP リクエスト
- メディア アップロード リクエスト用のアップロード URI:
POST https://gmail.googleapis.com/upload/gmail/v1/users/{userId}/messages
- メタデータ URI(メタデータのみのリクエストの場合):
POST https://gmail.googleapis.com/gmail/v1/users/{userId}/messages
この URL は gRPC Transcoding 構文を使用します。
パスパラメータ
パラメータ |
userId |
string
ユーザーのメールアドレス。特別な値 me を使用すると、認証済みユーザーを示すことができます。
|
クエリ パラメータ
パラメータ |
internalDateSource |
enum (InternalDateSource )
Gmail 内部のメールの日付のソース。
|
deleted |
boolean
メールを完全に削除(TRASH ではない)としてマークし、Google Vault で Vault 管理者にのみ表示されるようにします。Google Workspace アカウントでのみ使用されます。
|
リクエスト本文
リクエストの本文には Message
のインスタンスが含まれています。
レスポンスの本文
成功した場合、レスポンスの本文には Message
のインスタンスが含まれます。
認可スコープ
次の OAuth スコープのいずれかが必要です。
https://mail.google.com/
https://www.googleapis.com/auth/gmail.modify
https://www.googleapis.com/auth/gmail.insert
詳細については、承認ガイドをご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2024-09-05 UTC。
[null,null,["最終更新日 2024-09-05 UTC。"],[[["Directly inserts a message into the user's mailbox, similar to `IMAP APPEND`, bypassing most scanning and classification."],["Supports two types of requests: uploading media content (`POST /upload/...`) and sending metadata only (`POST /...`)."],["Requires providing the user's email address (`userId`) as a path parameter and offers optional query parameters to control internal date source and deletion behavior."],["The request and response bodies both utilize the `Message` resource for structuring email data."],["To authorize, you'll need one of the specified OAuth scopes related to Gmail access and modification."]]],["This content outlines the process for directly inserting a message into a user's Gmail mailbox. Key actions include using `POST` requests to either an upload URI (`/upload/gmail/v1/users/{userId}/messages`) or a metadata URI (`/gmail/v1/users/{userId}/messages`). The `userId` path parameter identifies the user, and query parameters like `internalDateSource` and `deleted` provide further message properties. A `Message` instance is sent in the request and returned in the response. Authentication requires specific OAuth scopes.\n"]]