mailsender

package
v0.0.0-...-f2350e3 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(opts CallOpts)

Execute send emails

Types

type CallOpts

type CallOpts struct {
	Filename   string
	FromName   string
	FromAddr   string
	Username   string
	Password   string
	Hostname   string
	Port       int
	UseAuth    bool
	Concurrent bool
	Number     int
}

CallOpts a list of flags

type Config

type Config struct {
	Host     string
	Port     int
	Username string
	Password string
	FromAddr string
	FromName string
	Auth     bool
}

Config .... Host is the server mail host, IP or address. Port is the listening port. Username and Passwordare required if auth set to true. FromName and FromAddr are standard mailing values and are in the format of FromName: AkronimBlack FromAddr: akronimBlack@hostname.com

type Email

type Email struct {
	Subject string   `json:"subject"`
	Body    string   `json:"body"`
	To      []string `json:"to"`
	Error   error
}

Email email structure expected from a file

type Mailer

type Mailer struct {
	// contains filtered or unexported fields
}

Mailer struct

func NewMailer

func NewMailer(cfg Config) *Mailer

NewMailer creates and returns a new mail sender. if FromName not set the first part of FromAddr will be taken. If FromAddr empty and username is given (in the correct format, with an @) then username will be taken as FromAddr

func (*Mailer) Send

func (m *Mailer) Send(subject string, body []byte, to []string) error

Send send email through smtp

Jump to

Keyboard shortcuts

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