smtp

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Signals a positive delivery action.
	EnhancedStatusCodeClassSuccess int = 2
	// Signals that there is a temporary failure in positively delivery action.
	EnhancedStatusCodeClassPersistentTransientFailure int = 4
	// Signals that there is a permanent failure in the delivery action.
	EnhancedStatusCodeClassPermanentFailure int = 5
)
View Source
const (
	// ReplyCodeSystemStatus is the status code for the system status.
	ReplyCodeSystemStatus = 211
	// ReplyCodeHelpMessage is the status code for the help message.
	ReplyCodeHelpMessage = 214
	// ReplyCodeServiceReady is the status code for the service ready.
	ReplyCodeServiceReady = 220
	// ReplyCodeServiceClosing is the status code for the service closing.
	ReplyCodeServiceClosing = 221
	// ReplyCodeAuthenticationSuccessful is the status code for the authentication successful.
	ReplyCodeMailActionOkay = 250
	// ReplyCodeUserNotLocal is the status code for the user not local.
	ReplyCodeMailActionCompleted = 250
	// ReplyCodeCannotVerifyUser is the status code for the cannot verify user.
	ReplyCodeUserNotLocal = 251
	// ReplyCodeStartMailInput is the status code for the start mail input.
	ReplyCodeCannotVerifyUser               = 252
	ReplyCodeStartMailInput                 = 354
	ReplyCodeServiceNotAvailable            = 421
	ReplyCodeMailboxUnavailable             = 450
	ReplyCodeLocalError                     = 451
	ReplyCodeInsufficientStorage            = 452
	ReplyCodeSyntaxError                    = 500
	ReplyCodeSyntaxErrorInParameters        = 501
	ReplyCodeCommandNotImplemented          = 502
	ReplyCodeCommandBadSequence             = 503
	ReplyCodeCommandParameterNotImplemented = 504
	ReplyCodeRequestActionNotTaken          = 550
	ReplyCodeUserNotLocalForThisHost        = 551
	ReplyCodeRequestedActionAborted         = 552
	ReplyCodeRequestedActionNotTaken        = 553
	ReplyCodeTransactionFailed              = 554
	ReplyCodeMailFromOrRcptToError          = 555
)
View Source
const (
	Network = "tcp"
)

Variables

This section is empty.

Functions

func ErrorFromStatus

func ErrorFromStatus(s *StatusCode) error

ErrorFromStatus returns an error from a status code.

func New added in v0.5.8

func New(opts ...Opt) *mta

New ...

Types

type EnhancedMailSystemStatusCode

type EnhancedMailSystemStatusCode [3]int

EnhancedMailSystemStatusCode ... https://datatracker.ietf.org/doc/html/rfc3463

var EnhancedStatusCodeUnknown EnhancedMailSystemStatusCode = EnhancedMailSystemStatusCode{-1, -1, -1}

EnhancedStatusCodeUnknown is the default value for the enhanced status code.

func (EnhancedMailSystemStatusCode) String added in v0.5.9

String returns the string representation of the enhanced status code.

type EnhancedStatusCode

type EnhancedStatusCode [3]int

EnhancedStatusCode is a data structure to contain enhanced mail system status codes from RFC 3463 (https://datatracker.ietf.org/doc/html/rfc3463).

func (EnhancedStatusCode) Class added in v0.5.9

func (e EnhancedStatusCode) Class() int

Class returns the class of the enhanced status code.

func (EnhancedStatusCode) Detail added in v0.5.9

func (e EnhancedStatusCode) Detail() int

Detail returns the detail of the enhanced status code.

func (EnhancedStatusCode) Subject added in v0.5.9

func (e EnhancedStatusCode) Subject() int

Subject returns the subject of the enhanced status code.

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error is an error as defined in RFC 5321.

func (*Error) Error

func (e *Error) Error() string

Error returns error message.

func (*Error) Temporary

func (e *Error) Temporary() bool

Temporary returns true if the error is temporary.

type Header string

Header ...

const Bcc Header = "Bcc"

Bcc ...

const Cc Header = "Cc"

Cc ...

const Date Header = "Date"

Date ...

const From Header = "From"

From ...

const ReplyTo Header = "Reply-To"

ReplyTo ...

const Subject Header = "Subject"

Subject ...

const To Header = "To"

To ...

type MTA added in v0.5.8

type MTA interface {
	server.Listener
}

MTA ...

type Message added in v0.5.9

type Message struct {
	// ID ...
	ID string `json:"id" yaml:"id"`
	// Headers ...
	Headers map[Header][]string `json:"headers" yaml:"headers"`
}

Message ...

func NewMessage added in v0.5.9

func NewMessage() (*Message, error)

NewMessage ...

func (*Message) SetID added in v0.5.9

func (m *Message) SetID(id string)

SetID ...

type Opt added in v0.5.8

type Opt func(*Opts)

Opt ...

type Opts added in v0.5.8

type Opts struct {
	Addr string
}

Opts ...

func (*Opts) Configure added in v0.5.8

func (o *Opts) Configure(opts ...Opt)

Configure ...

type ReplyCode

type ReplyCode int

ReplyCode is the status code for the SMTP server.

type Session added in v0.5.8

type Session struct {
	// Text is the textproto.Conn of the connection.
	Text *textproto.Conn

	sync.Mutex
	// contains filtered or unexported fields
}

Session ...

func NewSession added in v0.5.9

func NewSession(conn net.Conn) *Session

NewSession...

func (*Session) Serve added in v0.5.9

func (s *Session) Serve() group.RunFunc

Serve ...

type StatusCode

type StatusCode struct {
	// contains filtered or unexported fields
}

StatusCode is a status code as defined in RFC 5321.

func NewStatusCode added in v0.5.9

func NewStatusCode(replyCode ReplyCode, enhancedCode EnhancedMailSystemStatusCode, message string) *StatusCode

NewStatusCode returns a new status code.

func (*StatusCode) Clone added in v0.5.9

func (s *StatusCode) Clone() *StatusCode

Clone returns a clone of the status code.

func (*StatusCode) EnhancedStatusCode

func (s *StatusCode) EnhancedStatusCode() EnhancedMailSystemStatusCode

EnhancedStatusCode returns the enhanced status code.

func (*StatusCode) Error

func (s *StatusCode) Error() string

Error returns error message.

func (*StatusCode) Message

func (s *StatusCode) Message() string

Message returns the message.

func (*StatusCode) ReplyCode

func (s *StatusCode) ReplyCode() int

ReplyCode returns the reply code.

func (*StatusCode) Reset added in v0.5.9

func (s *StatusCode) Reset()

Reset resets the status code.

type Verb added in v0.5.9

type Verb string

Verb is a command verb of SMTP.

const (
	// HELO is the SMTP verb for HELO.
	HELO Verb = "HELO"
	// EHLO is the SMTP verb for EHLO.
	EHLO Verb = "EHLO"
	// MAIL is the SMTP verb for MAIL.
	MAIL Verb = "MAIL"
	// RCPT is the SMTP verb for RCPT.
	RCPT Verb = "RCPT"
	// DATA is the SMTP verb for DATA.
	DATA Verb = "DATA"
	// QUI is the SMTP verb for QUIT.
	QUIT Verb = "QUIT"
	// RSET is the SMTP verb for RSET.
	RSET Verb = "RSET"
	// NOOP is the SMTP verb for NOOP.
	NOOP Verb = "NOOP"
	// HELP is the SMTP verb for HELP.
	HELP Verb = "HELP"
	// STARTTLS is the SMTP verb for STARTTLS.
	STARTTLS Verb = "STARTTLS"
	// AUTH is the SMTP verb for AUTH.
	AUTH Verb = "AUTH"
)

Jump to

Keyboard shortcuts

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