tk-pop3-client

0.1.6 • Public • Published

POP3 Client

References:

POP3 RFC

Github node-pop3

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>

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.6
    1
    • latest

Version History

Package Sidebar

Install

npm i tk-pop3-client

Weekly Downloads

1

Version

0.1.6

License

MIT

Unpacked Size

188 kB

Total Files

68

Last publish

Collaborators

  • chenjk110