mqd

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2016 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteSettings

func WriteSettings(path string, s *Settings) error

WriteSettings is a helper function to open a file and send it to the WriteSettingsTo function.

func WriteSettingsTo

func WriteSettingsTo(w io.Writer, s *Settings) error

WriteSettingsTo marshals the Settings config struct and sends it to the io.Writer, returning any errors encountered along the way.

Types

type ConnectionDetails

type ConnectionDetails struct {
	// Sender should be the plain, lowercase email address of the
	// account that the email will originate from.
	Sender string `json:"sender,omitempty"`
	// Server is the string representing the smtp host and port joined
	// by a colon.  e.g: smtp.example.com:25
	Server string `json:"server,omitempty"`
	// Host is just the host portion.  e.g: smtp.example.com
	Host string `json:"host,omitempty"`
	// AuthType shows which authentication mechanism should be used
	// when connecting to this Server.
	AuthType SMTPAuthType `json:"authtype"`
	// Username of the Sender account.
	Username string `json:"username,omitempty"`
	// Password of the Sender account.
	Password string `json:"password,omitempty"`
}

ConnectionDetails describe the metadata needed to complete an SMTP connection for a given sender.

func (*ConnectionDetails) Auth

func (d *ConnectionDetails) Auth() (smtp.Auth, error)

Auth returns an implementation of the smtp.Auth interface that can be used to perform the smtp authentication for this ConnectionDetails

func (*ConnectionDetails) String

func (d *ConnectionDetails) String() string

String implements the fmt.Stringer interface

type SMTPAuthType

type SMTPAuthType string

SMTPAuthType names smtp authentication methods

const (
	LoginAuth SMTPAuthType = "LOGIN"
	PlainAuth SMTPAuthType = "PLAIN"
)

type Settings

type Settings struct {
	C         map[string]ConnectionDetails `json:"connections"`
	MailQueue string                       `json:"mailqueue"`
	BadMail   string                       `json:"badmail"`
	SentMail  string                       `json:"sentmail"`
	Interval  int                          `json:"interval"`
}

Settings holds the configuration parameters used by the mail queue dispatcher.

func NewSettings

func NewSettings(mailqueue string, badmail string) *Settings

NewSettings generates a new Settings configuration, initializing it with the supplied mailqueue and badmail folders, and an empty map of connection details.

func ReadSettingsFrom

func ReadSettingsFrom(r io.Reader) (*Settings, error)

ReadSettingsFrom uses an io.Reader to read in JSON that is parsed into a Settings configuration object.

func UnmarshalSettings

func UnmarshalSettings(raw []byte) (*Settings, error)

UnmarshalSettings converts raw bytes that are expected to be in JSON format into the Settings configuration object.

func (*Settings) ConnectionForSender

func (s *Settings) ConnectionForSender(sender string) (ConnectionDetails, error)

ConnectionForSender uses the supplied sender and tries to find ConnectionDetails that match the email address.

func (*Settings) String

func (s *Settings) String() string

String fulfills the fmt.Stringer interface

Jump to

Keyboard shortcuts

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