email

package
v0.5.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfirmData

type ConfirmData struct {
	// Username to be addressed.
	Username string
	// URL of the instance to present to the receiver.
	InstanceURL string
	// Name of the instance to present to the receiver.
	InstanceName string
	// Link to present to the receiver to click on and do the confirmation.
	// Should be a full link with protocol eg., https://example.org/confirm_email?token=some-long-token
	ConfirmLink string
}

ConfirmData represents data passed into the confirm email address template.

type ResetData

type ResetData struct {
	// Username to be addressed.
	Username string
	// URL of the instance to present to the receiver.
	InstanceURL string
	// Name of the instance to present to the receiver.
	InstanceName string
	// Link to present to the receiver to click on and begin the reset process.
	// Should be a full link with protocol eg., https://example.org/reset_password?token=some-reset-password-token
	ResetLink string
}

ResetData represents data passed into the reset email address template.

type Sender

type Sender interface {
	// SendConfirmEmail sends a 'please confirm your email' style email to the given toAddress, with the given data.
	SendConfirmEmail(toAddress string, data ConfirmData) error

	// SendResetEmail sends a 'reset your password' style email to the given toAddress, with the given data.
	SendResetEmail(toAddress string, data ResetData) error
}

Sender contains functions for sending emails to instance users/new signups.

func NewNoopSender

func NewNoopSender(sendCallback func(toAddress string, message string)) (Sender, error)

NewNoopSender returns a no-op email sender that will just execute the given sendCallback every time it would otherwise send an email to the given toAddress with the given message value.

Passing a nil function is also acceptable, in which case the send functions will just return nil.

func NewSender

func NewSender() (Sender, error)

NewSender returns a new email Sender interface with the given configuration, or an error if something goes wrong.

Jump to

Keyboard shortcuts

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