smtp

package
v0.0.0-...-d62ea78 Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler func(mail *MailEnvelope)

Handler is a callback type for treating received mail

type MailEnvelope

type MailEnvelope struct {
	From    string
	To      []string
	Content []byte
}

MailEnvelope describes the minimum information sent and received by a mail server

type MailSender

type MailSender interface {
	SendMail(envelope *MailEnvelope) error
}

MailSender allows simple mail sending.

type MailServer

type MailServer struct {
	Address string
	Handler Handler
}

MailServer contains the information necessary to run a server which receives and handles mail.

func NewServer

func NewServer(Address string, Handler Handler) *MailServer

NewServer returns a MailServer struct given a listening address and a mail handler.

func (*MailServer) Run

func (server *MailServer) Run()

Run starts a goroutine which listens and processes mail as it arrives.

type SingleServerSendMailer

type SingleServerSendMailer struct {
	Server string
}

SingleServerSendMailer sends mails via one specified SMTP server.

func NewSingleServerSendMailer

func NewSingleServerSendMailer(Server string) *SingleServerSendMailer

NewSingleServerSendMailer returns a MailSender offering outgoing SMTP functionality.

func (SingleServerSendMailer) SendMail

func (mailer SingleServerSendMailer) SendMail(envelope *MailEnvelope) (err error)

SendMail tries to send the given mail envelope via the configured SMTP server

Jump to

Keyboard shortcuts

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