email

package
v0.31.2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

README

Mainflux Email Agent

Mainflux Email Agent is used for sending emails. It wraps basic SMTP features and provides a simple API that Mainflux services can use to send email notifications.

Configuration

Mainflux Email Agent is configured using the following configuration parameters:

Parameter Description
MF_EMAIL_HOST Mail server host
MF_EMAIL_PORT Mail server port
MF_EMAIL_USERNAME Mail server username
MF_EMAIL_PASSWORD Mail server password
MF_EMAIL_FROM_ADDRESS Email "from" address
MF_EMAIL_FROM_NAME Email "from" name
MF_EMAIL_TEMPLATE Email template for sending notification emails

There are two authentication methods supported: Basic Auth and CRAM-MD5. If MF_EMAIL_USERNAME is empty, no authentication will be used.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEmail

func IsEmail(email string) bool

Types

type Agent added in v0.23.1

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

Agent for mailing

func New added in v0.23.1

func New(c *Config) (*Agent, error)

New creates new email agent

func (*Agent) Send added in v0.23.1

func (a *Agent) Send(To []string, From, Subject, TemplateName string, TemplateData map[string]any) error

Send sends an e-mail message comprised of the Agent's base template and the template idenitifed by `TemplateName`, which must be the filename of the subtemplate, without an extension.

type Config added in v0.23.1

type Config struct {
	Host             string
	Port             string
	Username         string
	Password         string
	FromAddress      string
	FromName         string
	BaseTemplatePath string
}

Config email agent configuration.

Jump to

Keyboard shortcuts

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