smtp

package
v1.61.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2018 License: AGPL-3.0 Imports: 4 Imported by: 6

Documentation

Overview

Package smtp provides access to SMTP server for sending email.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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

Types

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
}

Config is used to create SMTP server connection

type EmailMessage

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

EmailMessage represents email to be sent.

Jump to

Keyboard shortcuts

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