mailer

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package mailer implements common functionality for sending emails and for testing

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Renderer

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

Renderer for easy template of TXT or HTML

func TemplateHTML

func TemplateHTML(temp string) *Renderer

TemplateHTML - create template render for html

func TemplateTXT

func TemplateTXT(temp string) *Renderer

TemplateTXT - create template render

func (*Renderer) Render

func (r *Renderer) Render(data interface{}) string

Render template

type Service

type Service struct {
	SMTPHost     string       `config:"smtp_host" toml:"smtp_host"`
	SMTPPort     int          `config:"smtp_port" toml:"smtp_port"`
	SMTPUsername string       `config:"smtp_username" toml:"smtp_username"`
	SMTPPassword string       `config:"smtp_password" toml:"smtp_password"`
	SMTPSSL      bool         `config:"smtp_ssl"  toml:"smtp_ssl"`
	Dailer       *mail.Dialer `config:"-" toml:"-"`
	From         string       `config:"from" toml:"from"`
}

Service to send mail

func NewFakeServer

func NewFakeServer(log *zap.Logger) (*fakeServer, *Service)

NewFakeServer - to get mocked Service for mail-service

func (*Service) Ping

func (m *Service) Ping() error

Ping mailer

func (*Service) Setup

func (m *Service) Setup() error

Setup dailer (and ping)

type TestingMail

type TestingMail struct {
	Header textproto.MIMEHeader
	Body   string
}

TestingMail a mail in format from test server

Jump to

Keyboard shortcuts

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