smtp

package
v0.0.0-...-7b59768 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ignore                   StatusCode = -1
	Ready                               = 220
	Closing                             = 221
	AuthenticationSuccessful            = 235
	Ok                                  = 250
	StartAuth                           = 334
	StartSending                        = 354
	Unavailable                         = 421
	LocalError                          = 451
	CommandSyntaxError                  = 500
	ArgumentSyntaxError                 = 501
	BadSequence                         = 503
	CommandNotImplemented               = 504
	AuthenticationRequired              = 530
	AuthenticationInvalid               = 535
	TransactionFailed                   = 554
)

Variables

View Source
var (
	RxDomain       *regexp.Regexp = regexp.MustCompile(`^([a-zA-Z0-9]{1}[a-zA-Z0-9_-]{1,62}){1}(\.[a-zA-Z0-9]{1}[a-zA-Z0-9_-]{1,62})+$`)
	RxIP           *regexp.Regexp = regexp.MustCompile("^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$")
	RxEmailAddress *regexp.Regexp = regexp.MustCompile("^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\\])$")
)
View Source
var Extensions []string = []string{
	"PIPELINING",
	"8BITMIME",
}

packages should append() during init()

Functions

func FormatReply

func FormatReply(r Reply) string

func IsSuccess

func IsSuccess(r Reply) bool

func LastLine

func LastLine(r Reply) string

Types

type Client

type Client struct {
	Conn  net.Conn
	ID    string
	State SessionState
	Rdr   *bufio.ReadWriter
	Data  map[string]interface{}
	// contains filtered or unexported fields
}

func (*Client) Get

func (c *Client) Get(key string) interface{}

func (*Client) GetBool

func (c *Client) GetBool(key string) bool

func (*Client) GetString

func (c *Client) GetString(key string) string

func (*Client) GetStringSlice

func (c *Client) GetStringSlice(key string) []string

func (*Client) MakeReader

func (c *Client) MakeReader()

func (*Client) Receive

func (c *Client) Receive() (Command, error)

func (*Client) ResetData

func (c *Client) ResetData()

func (*Client) SaveData

func (c *Client) SaveData()

func (*Client) Send

func (c *Client) Send(r Reply)

func (*Client) Set

func (c *Client) Set(key string, value interface{})

type Command

type Command struct {
	Verb string
	Args string
}

type Reply

type Reply struct {
	Result  StatusCode
	Message string
}

type SessionState

type SessionState int
const (
	Any SessionState = iota
	Connected
	Identified       //after EHLO before MAIL
	ReceivingHeaders //after MAIL before/during RCPT
	ReceivingBody    //after DATA
	Disconnected
)

type StatusCode

type StatusCode int

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL