Documentation
¶
Index ¶
- func PopMails(ctx context.Context, cfg POP3ClientConfig, f func(*MailMessage) error) error
- type ListItem
- type Mail
- type MailMessage
- type POP3ClientConfig
- type POP3Conn
- func (c *POP3Conn) Close()
- func (c *POP3Conn) CloseOnErr() error
- func (c *POP3Conn) Delete(id int) error
- func (c *POP3Conn) GetMail(ctx context.Context, id int) (*MailMessage, error)
- func (c *POP3Conn) List(ctx context.Context) ([]ListItem, error)
- func (c *POP3Conn) ReadLinesToPoint(ctx context.Context) *POP3Conn
- func (c *POP3Conn) ReadOK(errstr string) *POP3Conn
- func (c *POP3Conn) Sendf(format string, args ...interface{}) *POP3Conn
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PopMails ¶
func PopMails(ctx context.Context, cfg POP3ClientConfig, f func(*MailMessage) error) error
Types ¶
type MailMessage ¶
type MailMessage struct {
From,
Subject,
Text string
}
type POP3ClientConfig ¶
type POP3Conn ¶
type POP3Conn struct {
// contains filtered or unexported fields
}
Example ¶
package main
import (
"context"
"time"
"log"
"github.com/covrom/pop3"
)
func main() {
cfg := pop3.POP3ClientConfig{
Host: "pop.mail.com",
Port: "995", // "110"
Username: "[email protected]",
Password: "",
Timeout: time.Minute,
TLSEnabled: true,
TLSSkipVerify: false,
}
if err := pop3.PopMails(context.Background(), cfg, func(msg *pop3.MailMessage) error {
log.Println(msg.From, msg.Subject, msg.Text)
return nil
}); err != nil {
log.Println(err)
}
}
func NewPOP3Conn ¶
func NewPOP3Conn(cfg POP3ClientConfig) (*POP3Conn, error)
func (*POP3Conn) CloseOnErr ¶
func (*POP3Conn) ReadLinesToPoint ¶
Click to show internal directories.
Click to hide internal directories.