mail

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const GLOBAL_CONFIG_FQDN_KEY = "fqdn"

Variables

This section is empty.

Functions

This section is empty.

Types

type OsReadFile

type OsReadFile func(name string) ([]byte, error)

OsReadFile defines a function type for reading a file from the given name and returning its contents as bytes.

type Sender

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

Sender provides functionality to send emails using a configured SMTP service.

func CreateSender

func CreateSender(config configuration.Smtp, sourceInstance string, attachments []string, globalConfigRepo globalConfigRepo) *Sender

CreateSender initializes and returns a new Sender instance with the provided configuration, sender service, and file reader.

func (*Sender) Send

func (s *Sender) Send(ctx context.Context, isFinal bool, migrationResult error, start time.Time, end time.Time) error

Send composes and sends an email containing the result of a migration operation.

The email includes a plain text body summarizing the migration status and optional file attachments. It uses multipart MIME encoding to support attachments and plain text.

Parameters:

  • success: Indicates whether the migration was successful.
  • attachments: List of file paths to include as attachments in the email.
  • sourceInstance: URL of the source system
  • targetInstance: URL of the target system.
  • start: Start time of the migration.
  • end: End time of the migration.
  • isFinal: Whether this is the final report of a migration process.

Returns an error if email composition or sending fails.

type SenderService

type SenderService func(addr string, a smtp.Auth, from string, to []string, msg []byte) error

SenderService defines a function type for sending an email using SMTP with the provided address, authentication, sender, recipients, and message body.

Jump to

Keyboard shortcuts

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