管理 POP 和 IMAP
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
您可以透過「設定」,設定透過 POP 和 IMAP 通訊協定存取 Gmail 時的行為。
如要瞭解如何 getPop、updatePop、getImap 或 updateImap,請參閱設定參考資料。
POP
啟用及停用存取權
您可以使用 accessWindow
屬性控管 POP 存取權。這項屬性不僅決定是否啟用 POP,也決定可擷取的郵件。
值 |
效果 |
disabled |
無法存取 POP |
allMail |
所有訊息都可使用 |
fromNowOn |
只能查看新訊息 |
郵件處置
您可以使用 disposition
屬性,設定透過 POP 擷取郵件的處置方式。
值 |
效果 |
archive |
將郵件移出收件匣 |
leaveInInbox |
不採取任何行動,讓郵件保留在收件匣中並維持未讀狀態 |
markRead |
將郵件標示為已讀取 |
trash |
郵件會移至垃圾桶 |
IMAP
啟用及停用存取權
您可以將 enabled
屬性設為 true
或 false
,分別啟用或停用 IMAP 存取權。
郵件處理方式
如要設定已刪除郵件的處置方式,請使用 expungeBehavior
屬性。
值 |
效果 |
archive |
將郵件移出收件匣 |
deleteForever |
永久刪除訊息 |
trash |
郵件會移至垃圾桶 |
此外,如果 autoExpunge
屬性設為 true
,系統會在透過 IMAP 刪除郵件時立即執行這些動作。否則,系統會保留郵件,直到 IMAP 用戶端明確要求為止。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-01 (世界標準時間)。
[null,null,["上次更新時間:2025-08-01 (世界標準時間)。"],[],[],null,["# Managing POP and IMAP\n\nYou can use [Settings](/workspace/gmail/api/reference/rest/v1/users.settings) to configure\nthe behavior of Gmail when accessed via the POP and IMAP protocols.\n\nFor information on how to\n[getPop](/workspace/gmail/api/reference/rest/v1/users.settings/getPop),\n[updatePop](/workspace/gmail/api/reference/rest/v1/users.settings/updatePop),\n[getImap](/workspace/gmail/api/reference/rest/v1/users.settings/getImap),\nor [updateImap](/workspace/gmail/api/reference/rest/v1/users.settings/updateImap), see\nthe [Settings reference](/workspace/gmail/api/reference/rest/v1/users.settings).\n\nPOP\n---\n\n### Enabling and disabling access\n\nYou can control POP access with the `accessWindow` property. The property not\nonly determines whether or not POP is enabled, but also which messages may be\nretrieved.\n\n| Value | Effect |\n|-------------|---------------------------------|\n| `disabled` | No POP access |\n| `allMail` | All messages are available |\n| `fromNowOn` | Only new messages are available |\n\n### Message disposition\n\nYou can configure the disposition of messages retrieved via POP with\nthe `disposition` property.\n\n| Value | Effect |\n|----------------|------------------------------------------------|\n| `archive` | Move messages out of the inbox |\n| `leaveInInbox` | Do nothing, leave messages unread in the inbox |\n| `markRead` | Mark the messages as read |\n| `trash` | Moves the message to the trash |\n\nIMAP\n----\n\n### Enabling and disabling access\n\nYou can control IMAP access by setting the `enabled` property to `true`\nor `false`, to enable or disable access respectively.\n\n### Message Disposition\n\nTo set the disposition for deleted messages, use the `expungeBehavior` property.\n\n| Value | Effect |\n|-----------------|--------------------------------|\n| `archive` | Move messages out of the inbox |\n| `deleteForever` | Permanently delete the message |\n| `trash` | Moves the message to the trash |\n\nAdditionally, if the `autoExpunge` property is set to `true` these actions\nare performed immediately when the message is deleted via IMAP. Otherwise\nmessages are left until explicitly requested from the IMAP client."]]