email

package
v2.0.0-rc5+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2018 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package email handles the configuration of a mail-server, the authentication to this mail-server and creating and sending of emails.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetAuthentication

func SetAuthentication(auth Authentication)

SetAuthentication sets the authentication for the mail-server

func SetConfiguration

func SetConfiguration(config Configuration)

SetConfiguration sets the configuration of the mail-server

Types

type Authentication

type Authentication struct {
	Username string `name:"smtp-username"`
	Password string `name:"smtp-password"`
}

Authentication is used to authenticate with "Username" and "Password" to the "Hostname" of the Configuration.

func GetAuthentication

func GetAuthentication() Authentication

GetAuthentication returns the authentication for the mail-server

type Configuration

type Configuration struct {
	Hostname string `name:"smtp-hostname"`
	Port     int    `name:"smtp-port"`
}

Configuration contains the information of the mail-server.

func GetConfiguration

func GetConfiguration() Configuration

GetConfiguration returns the configuration of the mail-server

func (Configuration) GetAddress

func (c Configuration) GetAddress() string

GetAddress returns the address of the server in the format "hostname:port"

type STPEmail

type STPEmail struct {
	email.Email
}

STPEmail wraps the Email type of "github.com/jordan-wright/email"

This makes the sending and configuration of emails easier.

func New

func New(to, bcc, cc []string, subject string, text, html []byte) *STPEmail

New creates a new STPEmail with all the information given.

Returns the email.

func (STPEmail) AttachFile

func (e STPEmail) AttachFile(filename string) error

AttachFile attaches a file with the given name to the STPEmail.

Returns an error if any occurred.

func (STPEmail) Send

func (e STPEmail) Send() error

Send sends the STPEmail.

It uses the configured settings for the mail server.

Returns an error if any occurred.

Jump to

Keyboard shortcuts

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