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) ולאדמין של Vault יש אפשרות לראות אותו רק ב-Google Vault. לשימוש בחשבונות Google Workspace בלבד.
|
גוף הבקשה
גוף הבקשה מכיל מופע של Message
.
גוף התגובה
אם הפעולה בוצעה ללא שגיאות, גוף התגובה יכלול מופע של Message
.
היקפי הרשאות
כדי להשתמש בתכונה הזו יש צורך באחד מההיקפים הבאים של OAuth:
https://mail.google.com/
https://www.googleapis.com/auth/gmail.modify
https://www.googleapis.com/auth/gmail.insert
למידע נוסף, ניתן לעיין במדריך ההרשאות.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 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"]]