mailer

package
v0.12.7 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Email

type Email interface {
	Recipient() string      // Имя получателя сообения
	RecipientEmail() string // Email получателя сообщения
	MessageSubject() string // Тема письма
	MessageType() string    // ContentType письма
	MessageContent() []byte // Сообщение
}

Интерфейс для отправки сообщений средствами Email

func NewHtmlMail

func NewHtmlMail(name string, email string, subject string, message []byte) Email

Создает новое сообзение с HTML разметкой

func NewPlainMail

func NewPlainMail(name, email, sub, message string) Email

Создает новое простое сообщение

type HTMLEmail

type HTMLEmail struct {
	Name    string
	Email   string
	Subject string
	Message []byte
}

Структура для отправки сообщения с HTML разметкой

func (*HTMLEmail) MessageContent

func (m *HTMLEmail) MessageContent() []byte

Тело сообщения

func (*HTMLEmail) MessageSubject

func (m *HTMLEmail) MessageSubject() string

Тема сообщения

func (*HTMLEmail) MessageType

func (m *HTMLEmail) MessageType() string

ContentType

func (*HTMLEmail) Recipient

func (m *HTMLEmail) Recipient() string

Имя получателя

func (*HTMLEmail) RecipientEmail

func (m *HTMLEmail) RecipientEmail() string

Email получателя

type Mailer

type Mailer interface {
	Send(Email) error
}

func NewMailer

func NewMailer() Mailer

Инициализация Mailer'a из настроек в БД в случае если конфигурация не будет найдена, то в БД будет создан новый документ, с пустыми параметрами. После создания нового документа будет вызвана паника для остановки приложения.

func NewMailerPreferences

func NewMailerPreferences(preferences Preferences) Mailer

Инициализация Mailer'a с произвольными настройками Данная функция пригодится для проектов, в кторых нет доступа к MongoDB из-за их простоты или по другим причинам

type PlainMail

type PlainMail struct {
	Name    string
	Email   string
	Subject string
	Message string
}

Структура для отправки простого письма

func (*PlainMail) MessageContent

func (pm *PlainMail) MessageContent() []byte

Тело сообщения

func (*PlainMail) MessageSubject

func (pm *PlainMail) MessageSubject() string

Тема сообщения

func (*PlainMail) MessageType

func (pm *PlainMail) MessageType() string

Тип контента

func (*PlainMail) Recipient

func (pm *PlainMail) Recipient() string

Имя адресата сообщения

func (*PlainMail) RecipientEmail

func (pm *PlainMail) RecipientEmail() string

Email адресата сообщения

type Preferences

type Preferences struct {
	Host     string `bson:"host"`
	Port     string `bson:"port"`
	Name     string `bson:"name"`
	Email    string `bson:"email"`
	Login    string `bson:"login"`
	Password string `bson:"password"`
}

Настройки для подключения к Email серверу с целью отправки почты

Jump to

Keyboard shortcuts

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