email

package
v0.0.0-...-b891794 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package email provides email sending functionality.

Index

Constants

View Source
const (
	SubjectWelcome = "welcome"
	SubjectVerify  = "verify"
	SubjectReport  = "report"
)

Variables

View Source
var ErrInvalidSubject = errors.New(
	"invalid email subject, choose from 'welcome', 'verify' or 'report'",
)

Functions

This section is empty.

Types

type GmailSender

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

GmailSender is an email sender that sends emails using Gmail.

func NewGmailSender

func NewGmailSender(address, password string) *GmailSender

func (GmailSender) Send

func (s GmailSender) Send(payload *SenderPayload) error

type Sender

type Sender interface {
	Send(payload SenderPayload) error
}

Sender represents an email sender.

type SenderPayload

type SenderPayload struct {
	To      string `json:"to"`
	Subject string `json:"subject"`
	Data    any    `json:"data"`
}

func (*SenderPayload) UnmarshalJSON

func (sp *SenderPayload) UnmarshalJSON(data []byte) error

type SubjectReportData

type SubjectReportData struct {
	Username string `json:"username"`
}

type SubjectVerifyData

type SubjectVerifyData struct {
	Username string `json:"username"`
	Link     string `json:"link"`
}

type SubjectWelcomeData

type SubjectWelcomeData struct {
	Username string `json:"username"`
}

Jump to

Keyboard shortcuts

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