func (c *Client) Rset() (err error) {
	_, err = c.Cmd("RSET\r\n")
	return
}
Rset unmarks any messages marked for deletion previously in this session.
package pop3
import (
	"bufio"
	"crypto/tls"
	"errors"
	"fmt"
	"net"
	"strconv"
	"strings"
)
type Client struct {
	conn net.Conn
	bin  *bufio.Reader
}
func Dial(addr string) (*Client, error) {
	conn, err := net.Dial("tcp", addr)
	if err != nil {
		return nil, err
	}
	return NewClient(conn)
}
func DialTLS(addr string) (*Client, error) {
	conn, err := tls.Dial("tcp", addr, nil)
	if err != nil {
		return nil, err
	}
	return NewClient(conn)
}
func NewClient(conn net.Conn) (*Client, error) {
	client := &Client{
		bin:  bufio.NewReader(conn),
		conn: conn,
	}
	_, err := client.Cmd("")
	if err != nil {
		return nil, err
	}
	return client, nil
}
func (c *Client) Cmd(format string, args ...interface{}) (string, error) {
	fmt.Fprintf(c.conn, format, args...)
	line, _, err := c.bin.ReadLine()
	if err != nil { return "", err }
	l := string(line)
	if l[0:3] != "+OK" {
		err = errors.New(l[5:])
	}
	if len(l) >= 4 {
		return l[4:], err
	}
	return "", err
}
func (c *Client) ReadLines() (lines []string, err error) {
	lines = make([]string, 0)
	l, _, err := c.bin.ReadLine()
	line := string(l)
	for err == nil && line != "." {
		if len(line) > 0 && line[0] == '.' {
			line = line[1:]
		}
		lines = append(lines, line)
		l, _, err = c.bin.ReadLine()
		line = string(l)
	}
	return
}
func (c *Client) User(username string) (err error) {
	_, err = c.Cmd("USER %s\r\n", username)
	return
}
func (c *Client) Pass(password string) (err error) {
	_, err = c.Cmd("PASS %s\r\n", password)
	return
}
func (c *Client) Auth(username, password string) (err error) {
	err = c.User(username)
	if err != nil {
		return
	}
	err = c.Pass(password)
	return
}
func (c *Client) Stat() (count, size int, err error) {
	l, err := c.Cmd("STAT\r\n")
	if err != nil {
		return 0, 0, err
	}
	parts := strings.Fields(l)
	count, err = strconv.Atoi(parts[0])
	if err != nil {
		return 0, 0, errors.New("Invalid server response")
	}
	size, err = strconv.Atoi(parts[1])
	if err != nil {
		return 0, 0, errors.New("Invalid server response")
	}
	return
}
func (c *Client) List(msg int) (size int, err error) {
	l, err := c.Cmd("LIST %d\r\n", msg)
	if err != nil {
		return 0, err
	}
	size, err = strconv.Atoi(strings.Fields(l)[1])
	if err != nil {
		return 0, errors.New("Invalid server response")
	}
	return size, nil
}
func (c *Client) ListAll() (msgs []int, sizes []int, err error) {
	_, err = c.Cmd("LIST\r\n")
	if err != nil {
		return
	}
	lines, err := c.ReadLines()
	if err != nil {
		return
	}
	msgs = make([]int, len(lines), len(lines))
	sizes = make([]int, len(lines), len(lines))
	for i, l := range lines {
		var m, s int
		fs := strings.Fields(l)
		m, err = strconv.Atoi(fs[0])
		if err != nil {
			return
		}
		s, err = strconv.Atoi(fs[1])
		if err != nil {
			return
		}
		msgs[i] = m
		sizes[i] = s
	}
	return
}
func (c *Client) Retr(msg int) (text string, err error) {
	_, err = c.Cmd("RETR %d\r\n", msg)
	if err != nil {
		return "", err
	}
	lines, err := c.ReadLines()
	text = strings.Join(lines, "\n")
	return
}
func (c *Client) Dele(msg int) (err error) {
	_, err = c.Cmd("DELE %d\r\n", msg)
	return
}
func (c *Client) Noop() (err error) {
	_, err = c.Cmd("NOOP\r\n")
	return
}