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
พารามิเตอร์เส้นทาง
พารามิเตอร์ |
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 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"]]