mail

package
v1.2.141 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IMailClient

type IMailClient interface {
	MailUsr() string
	CreateTextMessage() IMailMessage
	CreateHtmlMessage() IMailMessage
	CreateJsonMessage() IMailMessage
	CreateTemplateMessage(template TemplateName, variables map[string]string) IMailMessage
}

IMailClient Mail client interface

func NewMailClient

func NewMailClient(config MailConfig) (IMailClient, error)

NewMailClient is a Mail client factory method

type IMailMessage

type IMailMessage interface {
	From(from string) IMailMessage
	To(to []string) IMailMessage
	Cc(cc []string) IMailMessage
	Subject(subject string) IMailMessage
	Body(body string) IMailMessage
	HtmlBody(html string) IMailMessage
	Attachments(attachments []MailMessageAttachment) IMailMessage
	Send() error
}

IMailMessage Mail message interface

type MailConfig

type MailConfig struct {

	// Mail relay URI (type://host:port)
	MailRelayUri string

	// Mail Relay User
	MailRelayUser string

	// Mail Relay Password
	MailRelayPassword string

	// Flag to use TLS encrypted connection
	UseTLS bool
}

MailConfig Configure mail client parameters

type MailMessageAttachment

type MailMessageAttachment struct {
	// The full file path to attach
	FileName string

	// MIME type, ignore this field, it will be set automatically
	ContentType string

	// Base64 content of the file (ignore this field)
	Base64Content string
}

MailMessageAttachment represents message attachment

type TemplateName

type TemplateName string

Jump to

Keyboard shortcuts

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