Managing POP and IMAP

You can use Settings to configure the behavior of Gmail when accessed via the POP and IMAP protocols.

For information on how to getPop, updatePop, getImap, or updateImap, see the Settings reference.

POP

Enabling and disabling access

You can control POP access with the accessWindow property. The property not only determines whether or not POP is enabled, but also which messages may be retrieved.

Value Effect
disabled No POP access
allMail All messages are available
fromNowOn Only new messages are available

Message disposition

You can configure the disposition of messages retrieved via POP with the disposition property.

Value Effect
archive Move messages out of the inbox
leaveInInbox Do nothing, leave messages unread in the inbox
markRead Mark the messages as read
trash Moves the message to the trash

IMAP

Enabling and disabling access

You can control IMAP access by setting the enabled property to true or false, to enable or disable access respectively.

Message Disposition

To set the disposition for deleted messages, use the expungeBehavior property.

Value Effect
archive Move messages out of the inbox
deleteForever Permanently delete the message
trash Moves the message to the trash

Additionally, if the autoExpunge property is set to true these actions are performed immediately when the message is deleted via IMAP. Otherwise messages are left until explicitly requested from the IMAP client.