mailapi

package
v0.0.0-...-3d49ce5 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Name    string `json:"name"`
	Address string `json:"address"`
}

type Attachment

type Attachment struct {
	ContentType string `json:"contentType"`
	Name        string `json:"name"`
	Filename    string `json:"filename"`
	Data        string `json:"data"`
}

func (Attachment) Validate

func (a Attachment) Validate(v *jug.Validator)

type Config

type Config struct {
	Host   string       `yaml:"host"`
	ApiKey string       `yaml:"apiKey"`
	Smtp   SenderConfig `yaml:"smtp"`
}

type Email

type Email struct {
	From        Address      `json:"from"`
	To          Address      `json:"to"`
	Cc          []Address    `json:"cc"`
	Bcc         []Address    `json:"bcc"`
	Subject     string       `json:"subject"`
	ContentType string       `json:"contentType"`
	Content     string       `json:"content"`
	TextContent string       `json:"textContent"`
	HtmlContent string       `json:"htmlContent"`
	Attachments []Attachment `json:"attachments"`
}

func (Email) HasAttachments

func (e Email) HasAttachments() bool

func (Email) IsAlternativeMail

func (e Email) IsAlternativeMail() bool

func (Email) IsHtmlMail

func (e Email) IsHtmlMail() bool

func (Email) IsTextMail

func (e Email) IsTextMail() bool

func (Email) Validate

func (e Email) Validate() error

type Sender

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

func NewSender

func NewSender(config SenderConfig) *Sender

func (*Sender) Send

func (s *Sender) Send(m Email) error

type SenderConfig

type SenderConfig struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	Tls      bool   `yaml:"tls"`
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

func (SenderConfig) Address

func (c SenderConfig) Address() string

func (SenderConfig) Auth

func (c SenderConfig) Auth() smtp.Auth

Jump to

Keyboard shortcuts

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