pmail

package
v0.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendEmail

func SendEmail(cfg Config, tags []string, filePath string)

Types

type Config

type Config struct {
	Accounts   []EmailAccount     `yaml:"accounts"`
	TagMapping map[string]Message `yaml:"tags"`
}

Config represents the overall configuration structure.

func LoadConfig

func LoadConfig(filePath string) (Config, error)

LoadConfig reads the configuration from the specified YAML file.

type EmailAccount

type EmailAccount struct {
	Name  string     `yaml:"name"`
	Email string     `yaml:"email"`
	SMTP  SMTPConfig `yaml:"smtp"`
}

EmailAccount represents an email account configuration.

type Message

type Message struct {
	From              string   `yaml:"from"`
	To                []string `yaml:"to"`
	CC                []string `yaml:"cc"`
	BCC               []string `yaml:"bcc"`
	Subject           string   `yaml:"subject"`
	Body              string   `yaml:"body"`
	IncludeAttachment bool     `yaml:"include_attachment"`
	// contains filtered or unexported fields
}

func (*Message) AttachFile

func (m *Message) AttachFile(src string) error

func (*Message) ToBytes

func (m *Message) ToBytes() []byte

type SMTPConfig

type SMTPConfig struct {
	Server             string `yaml:"server"`
	Port               int    `yaml:"port"`
	Username           string `yaml:"username"`
	Password           string `yaml:"password"`
	EnableTLS          bool   `yaml:"tls"`
	InsecureSkipVerify bool   `yaml:"insecure_skip_verify"`
}

SMTPConfig represents SMTP configuration for an email account.

Jump to

Keyboard shortcuts

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