mailing

package
v0.0.0-...-6623458 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2016 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MailersByName = map[string]MailerCreator{
	"smtp":     SMTPMailerCreator,
	"sendmail": SendmailMailerCreator}

Functions

This section is empty.

Types

type Mailer

type Mailer interface {
	Mail(to, from string, msg []byte) error
}

Mailer is a interface that defines the Mail function.

func SMTPMailerCreator

func SMTPMailerCreator(conf simpleconf.Config) (Mailer, error)

SMTPMailerCreator creates an SMTPMailer using configuration values in the [mail] section.

addr    - The address of the smtp server (go notation)
user    - Username
passwd  - Password
crammd5 - Should CRAMMD5 (on) or PLAIN (off) be used?
host    - The expected hostname of the mailserver (can be left out, if crammd5 is on)

func SendmailMailerCreator

func SendmailMailerCreator(conf simpleconf.Config) (Mailer, error)

SendmailMailerCreator creates an SendmailMailer using configuration values in the [mail] section.

exec - The name of the executable
argX - (optional) Additional arguments for the executable. X is a ascending number starting with 1

type MailerCreator

type MailerCreator func(conf simpleconf.Config) (Mailer, error)

MailerCreator is a function that creates a Mailer instance from config values.

type SMTPMailer

type SMTPMailer struct {
	Host       string // Host is the expected hostname of the server
	Addr       string // Addr is the address of the server
	UseCRAMMD5 bool
	Username   string
	Password   string
}

SMTPMailer is a Mailer implementation that sends mail via an smtp server.

func (SMTPMailer) Mail

func (sm SMTPMailer) Mail(to, from string, msg []byte) error

type SendmailMailer

type SendmailMailer struct {
	Exec string
	Args []string
}

SendmailMailer is a Mailer implementation that sends mail using a sendmail-ish executable.

Sendmail-ish in this context means:

  • The executable must accept the from address using the `-f <addr>` switch
  • The executable must accept the to address as a parameter
  • The executable expects a mail (including all headers) on stdin that is terminated by EOF

func (SendmailMailer) Mail

func (sm SendmailMailer) Mail(to, from string, msg []byte) (outerr error)

Jump to

Keyboard shortcuts

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