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
网址采用 gRPC 转码语法。
路径参数
参数 |
userId |
string
用户的电子邮件地址。特殊值 me 可用于指示经过身份验证的用户。
|
查询参数
参数 |
internalDateSource |
enum (InternalDateSource )
Gmail 邮件的内部日期来源。
|
deleted |
boolean
将该电子邮件标记为已永久删除(而非 TRASH),并且只有保险柜管理员可在 Google 保险柜中看到该电子邮件。仅用于 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 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-09-05。
[null,null,["最后更新时间 (UTC):2024-09-05。"],[[["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"]]