tk-pop3-client
v0.1.6
Published
A Simple POP3 Client written with TypeScript
Downloads
108
Readme
POP3 Client
References:
Examples:
import { Client } from './tk-pop3-client'
const client = new Client({
host: 'xxx.xxx.xx.xx',
port: 9090,
username: 'username',
password: 'password',
tls: true,
timeout: 10000
})
client.STAT().then(result => {
///
})
client.QUIT().then(info => {
///
})
API:
Client
interface IClientOptions {
username: string
password: string
host: string
port: number
tls?: boolean
timeout?: number
}
static create(options: IClientOptions): Client
public UIDL(msgOrder?: string): Promise<string[] | string[][]>
public NOOP(): Promise<void>
public LIST(msgOrder?: string): Promise<string[] | string[][]>
public RSET(): Promise<string>
public RETR(msgOrder?: string): Promise<string>
public DELE(msgOrder?: string): Promise<string>
public STAT(): Promise<string>
public TOP(msgOrder: string, n?: number): Promise<string>
public QUIT(): Promise<string>
Command
type CommandKeywords =
// Minimal POP3 Command Keywords:
| 'USER'
| 'PASS'
| 'QUIT'
| 'STAT'
| 'LIST'
| 'RETR'
| 'DELE'
| 'NOOP'
| 'RSET'
| 'QUIT'
// Optional POP3 Command Keywords:
| 'APOP'
| 'TOP'
| 'UIDL'
type CommandMessageContent =
| string
| Buffer
| { toString(): string }
static create(name: CommandKeywords, params?: string[], message?: CommandMessageContent): Command
static combine(...commands: Command[]): string
public toRaw(): string
public toString(): string
public update(params: string[], message: CommandMessageContent): this
public updateParams(params: string[]): this
public updateMessage(message: CommandMessageContent): this
Connection
interface IConnectionOptions {
host: string
port: number
tls?: boolean
timeout?: number
}
get connected(): boolean
static create(options: IConnectionOptions): Connection
public connect(): Promise<true>
public send(payload: string | Command): Promise<[string, Readable]>
public destroy(): Promise<true>