pymap.imap

class pymap.imap.IMAPService(backend, config)[source]

A pymap service implementing an IMAP server.

Parameters:
classmethod add_arguments(parser)[source]

Add the arguments or argument group used to configure the service. For example:

group = parser.add_argument_group('foo service arguments')
group.add_argument(...)
Parameters:

parser (ArgumentParser) – The argument parser.

Return type:

None

async start(stack)[source]

Start the service.

Parameters:

stack (AsyncExitStack) – An exit stack that should be used for cleanup.

Return type:

None

class pymap.imap.IMAPServer(login, config)[source]

Callable object that creates and runs IMAPConnection objects when asyncio.start_server() receives a new connection.

Parameters:
class pymap.imap.IMAPConnection(commands, config, reader, writer, sock_info)[source]

Runs a single IMAP connection from start to finish.

Parameters:
  • commands (Commands) – Defines the IMAP commands available to the connection.

  • config (IMAPConfig) – Settings to use for the IMAP connection.

  • reader (StreamReader) – The input stream for the socket.

  • writer (StreamWriter) – The output stream for the socket.

  • sock_info (SocketInfo)

async run(state)[source]

Start the socket communication with the IMAP greeting, and then enter the command/response cycle.

Parameters:

state (ConnectionState) – Defines the interaction with the backend plugin.

Return type:

None

class pymap.imap.state.ConnectionState(login, config)[source]

Defines the state flow of the IMAP connection. Determines if a command can be processed at that point in the connection, and interacts with the backend plugin.

Parameters: