smtp

package
v1.76.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2018 License: AGPL-3.0 Imports: 4 Imported by: 5 modules, 6 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
	ReplyTo   string
	ReplyName 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