email

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

README

SuperMQ Email Agent

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

Configuration

SuperMQ Email Agent is configured using the following configuration parameters:

Parameter Description
SMQ_EMAIL_HOST Mail server host
SMQ_EMAIL_PORT Mail server port
SMQ_EMAIL_USERNAME Mail server username
SMQ_EMAIL_PASSWORD Mail server password
SMQ_EMAIL_FROM_ADDRESS Email "from" address
SMQ_EMAIL_FROM_NAME Email "from" name
SMQ_EMAIL_TEMPLATE Email template for sending notification emails

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

Documentation

Overview

Package email contains the domain concept definitions needed to support SuperMQ email functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

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

Agent for mailing.

func New

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

New creates new email agent.

func (*Agent) Send

func (a *Agent) Send(to []string, from, subject, header, user, content, footer string) error

Send sends e-mail.

type Config

type Config struct {
	Host        string `env:"SMQ_EMAIL_HOST"         envDefault:"localhost"`
	Port        string `env:"SMQ_EMAIL_PORT"         envDefault:"25"`
	Username    string `env:"SMQ_EMAIL_USERNAME"     envDefault:"root"`
	Password    string `env:"SMQ_EMAIL_PASSWORD"     envDefault:""`
	FromAddress string `env:"SMQ_EMAIL_FROM_ADDRESS" envDefault:""`
	FromName    string `env:"SMQ_EMAIL_FROM_NAME"    envDefault:""`
	Template    string `env:"SMQ_EMAIL_TEMPLATE"     envDefault:"email.tmpl"`
}

Config email agent configuration.

Jump to

Keyboard shortcuts

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