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 SubjectWelcomeData ¶
type SubjectWelcomeData struct {
Username string `json:"username"`
}
Click to show internal directories.
Click to hide internal directories.