Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type UserConfig ¶
type UserConfig struct { SMTPServerHost string SMTPServerPort string FromAddress string ToAddress string UserName string Password string // Should only be used during testing. We can simulate all aspects of TLS // in a test environment but certification verification, since any cert used // by a test server would need to be self signed. SkipCertVerification bool }
UserConfig represents config options provided the user. Not meant to be used directly for sending email without validation.
Normally taking file paths as user input isn't great for testing, but we're accommodating the tls package which uses these. https://golang.org/pkg/crypto/tls/#LoadX509KeyPair
func (*UserConfig) CheckAndSetDefaults ¶
func (c *UserConfig) CheckAndSetDefaults() (UserConfig, error)
CheckAndSetDefaults validates s and either returns a copy of c with default settings applied or returns an error due to an invalid configuration
func (UserConfig) SendNewsletter ¶
func (uc UserConfig) SendNewsletter(asText, asHTML []byte) error
SendNewsletter sends the newsletter to the SMTP server. Callers must supply the newsletter as the `text/plain` MIME type in the asText param and the `text/html` type in asHTML. A lack of an error means the message was received by the destination SMTP server.
func (*UserConfig) UnmarshalYAML ¶
func (uc *UserConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the yaml.Unmarshaler interface. Validation is performed here.