Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteSettings ¶
WriteSettings is a helper function to open a file and send it to the WriteSettingsTo function.
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 ¶
NewSettings generates a new Settings configuration, initializing it with the supplied mailqueue and badmail folders, and an empty map of connection details.
func ReadSettingsFrom ¶
ReadSettingsFrom uses an io.Reader to read in JSON that is parsed into a Settings configuration object.
func UnmarshalSettings ¶
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.