app

package
v0.0.0-...-75ff2b4 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const GpgMessage = `
-----BEGIN PGP MESSAGE-----

%s
-----END PGP MESSAGE-----
`

Variables

This section is empty.

Functions

func SendAsync

func SendAsync(message *Message, config *Config)

Types

type Config

type Config struct {
	Domains   []string
	FormTitle string `mapstructure:"form_title"`
	Port      int
	Version   string
	Mailer    Mailer
	Logs      Logs
	GPG       GPG
}

type GPG

type GPG struct {
	PubKey   string `mapstructure:"pub_key"`
	Entities []*openpgp.Entity
}

func (*GPG) Encrypt

func (g *GPG) Encrypt(message []byte) ([]byte, error)

type Logs

type Logs struct {
	Level string
}

type Mailer

type Mailer struct {
	Host      string
	Port      *int
	User      string
	Pass      string
	Retries   int
	SendTo    *string `mapstructure:"send_to"`
	FromEmail string  `mapstructure:"from_email"`
}

type Message

type Message struct {
	Subject string
	Body    string
	RawBody []byte
}

func (*Message) Encrypt

func (m *Message) Encrypt(gpg *GPG) ([]byte, error)

func (*Message) IsValid

func (m *Message) IsValid() bool

type Sender

type Sender struct {
	Retries int
}

func (Sender) SendMessage

func (m Sender) SendMessage(message *Message, mailer *Mailer) error

Send encrypted email with GPG and retry with exponential backoff until retry limit reached will return and error if it failed.

Jump to

Keyboard shortcuts

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