email

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: AGPL-3.0 Imports: 11 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 NewReportData added in v0.8.0

type NewReportData struct {
	// URL of the instance to present to the receiver.
	InstanceURL string
	// Name of the instance to present to the receiver.
	InstanceName string
	// URL to open the report in the settings panel.
	ReportURL string
	// Domain from which the report originated.
	// Can be empty string for local reports.
	ReportDomain string
	// Domain targeted by the report.
	// Can be empty string for local reports targeting local users.
	ReportTargetDomain string
}

type ReportClosedData added in v0.8.0

type ReportClosedData 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
	// Username of the report target.
	ReportTargetUsername string
	// Domain of the report target.
	// Can be empty string for local reports targeting local users.
	ReportTargetDomain string
	// Comment left by the admin who closed the report.
	ActionTakenComment string
}

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

	// SendTestEmail sends a 'testing email sending' style email to the given toAddress, with the given data.
	SendTestEmail(toAddress string, data TestData) error

	// SendNewReportEmail sends an email notification to the given addresses, letting them
	// know that a new report has been created targeting a user on this instance.
	//
	// It is expected that the toAddresses have already been filtered to ensure that they
	// all belong to admins + moderators.
	SendNewReportEmail(toAddresses []string, data NewReportData) error

	// SendReportClosedEmail sends an email notification to the given address, letting them
	// know that a report that they created has been closed / resolved by an admin.
	SendReportClosedEmail(toAddress string, data ReportClosedData) 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.

type TestData added in v0.8.0

type TestData struct {
	// Username of admin user who sent the test.
	SendingUsername string
	// URL of the instance to present to the receiver.
	InstanceURL string
	// Name of the instance to present to the receiver.
	InstanceName string
}

Jump to

Keyboard shortcuts

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