Back to godoc.org
github.com/documize/community / domain / smtp

package smtp

v3.2.0+incompatible
Latest Go to latest
Published: Aug 29, 2019 | License: AGPL-3.0 | Module: github.com/documize/community

Overview

Package smtp provides access to SMTP server for sending email.

Index

func Connect

func Connect(c Config) (d *mail.Dialer, err error)

Connect returns open connection to server for sending email

func SendMessage

func SendMessage(d *mail.Dialer, c Config, em EmailMessage) (b bool, err error)

SendMessage sends email using specified SMTP connection

type Config

type Config struct {
	// IP/hostname of SMTP server
	Host string

	// Port number of SMTP server
	Port int

	// Username for authentication with SMTP server
	Username string

	// Password for authentication with SMTP server
	Password string

	// SenderEmail is FROM address
	SenderEmail string

	// SenderName is FROM display name
	SenderName string

	// AnonymousAuth does not send username/password to server
	AnonymousAuth bool

	// Base64EncodeCredentials encodes User and Password as base64 before sending to SMTP server
	Base64EncodeCredentials bool

	// UseSSL uses SMTP SSL connection with SMTP server
	UseSSL bool

	// SkipSSLVerify allows unverified certificates
	SkipSSLVerify bool

	// SenderFQDN is the sending servers fully qualified domain name
	// as some SMTP servers require a value other than localhost.
	// e.g. docs.example.org
	SenderFQDN string
}

Config is used to create SMTP server connection

type EmailMessage

type EmailMessage struct {
	ToEmail   string
	ToName    string
	Subject   string
	BodyHTML  string
	ReplyTo   string
	ReplyName string
}

EmailMessage represents email to be sent.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier