David Evans d936fce407 Replace UIDSet* with generic MessageIdentificationSet (#638)
In a previous PR we made UID conform to a new protocol MessageIdentifier. This PR continues the trend of removing concrete types and replacing them with generic types.

In this case we have UIDSet and UIDSetNonEmpty. These are identical to SequenceNumberSet and SequenceNumberSetNonEmpty. To allow us to remove the duplicate code a new generic type MessageIdentifierSet has been defined that takes a generic parameter T: MessageIdentifier. Both UID and SequenceNumber conform to MessageIdentifier.

In the next PR I will remove the code for SequenceNumberSet* and replace with MessageIdentifierSet. This PR only addresses the UIDSet* types.

Note: I will update all documentation in another (probably the last) PR.
2021-11-24 09:53:56 +00:00
2020-03-02 17:38:33 +00:00
2021-02-12 12:08:41 +00:00
2020-03-02 17:38:33 +00:00
2020-03-27 14:25:33 +00:00
2021-04-28 11:24:27 +01:00
2020-03-02 17:35:21 +00:00
2021-02-16 15:56:57 +00:00
2021-11-15 10:47:10 +00:00
2021-03-09 13:15:10 +00:00

swift-nio-imap

A Swift project that provides an implementation of the IMAP4rev1 protocol, built upon SwiftNIO.

Introduction and Usage

swift-nio-imap implements the IMAP4rev1 protocol described in RFC 3501 and related RFCs. It is intended as a building block to build mail clients and/or servers. It is built upon SwiftNIO v2.x.

To use the framework use import NIOIMAP. NIOIMAP supports a variety of IMAP extensions, check EXTENSIONS.md for full details.

Commands

Commands are what an IMAP client sends to a server.

A command consists of a Tag and a Command.

Examples

Command("tag1", .noop) => tag1 NOOP Command("tag2", .capability) => tag1 CAPABILITY Command("tag3", .login("email@apple.com", "password")) => tag3 LOGIN "email@apple.com" "password"

To send a command we recommend using a MessageToByteHandler with CommandEncoder as the encoder:

ClientBootstrap(group: context.eventLoop).channelInitializer { channel in
  channel.addHandler(MessageToByteHandler(CommandEncoder()))
}

Alternatively, you can write a command manually to a ByteBuffer manually like this:

let command = ...
var buffer = ...
let writtenSize = buffer.writeCommand(command)

Sample applications

Proxy

We provide a simple proxy that can be placed between some mail client and server. The mail server must support TLS.

swift run Proxy <local_address> <local_port> <server_address> <server_port>

CLI

The CLI allows you (the user) to connect to a mail server and enter commands. The mail server must support TLS. The CLI will always attempt to connect to the server on port 993.

swift run CLI

S
Description
Mirror of github.com/apple/swift-nio-imap
Readme Apache-2.0
18 MiB
0 Stars 1 Watchers 0 Forks
Languages
Swift 99.9%