sendemail

package
v0.0.0-...-151ba23 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	PasswordResetEmailSubject = "Deepfence - Reset Password"
	UserInviteEmailSubject    = "Deepfence - Invitation to join %s"
)

Variables

View Source
var (
	ErrNoEmailRecipients = errors.New("no email recipients")
	ErrNoEmailSubject    = errors.New("no email subject")
	ErrNoEmailBody       = errors.New("no email body")
)
View Source
var (
	EmailTemplates = template.Must(
		template.New("").Funcs(sprig.FuncMap()).ParseFS(emailTemplatesContent, []string{"templates/*.html"}...))
)

Functions

func RenderEmailTemplate

func RenderEmailTemplate(emailTemplateType EmailTemplateType, data interface{}) (string, error)

Types

type EmailSender

type EmailSender interface {
	Send(recipients []string, subject string, text string, html string, attachments map[string][]byte) error
}

func NewEmailSendByConfiguration

func NewEmailSendByConfiguration(ctx context.Context, emailConfig model.EmailConfigurationAdd) (EmailSender, error)

func NewEmailSender

func NewEmailSender(ctx context.Context) (EmailSender, error)

type EmailTemplateType

type EmailTemplateType string
const (
	PasswordResetTemplate EmailTemplateType = "reset-password.html"
	UserInviteTemplate    EmailTemplateType = "invite-user.html"
)

type PasswordReset

type PasswordReset struct {
	Project    string
	Username   string
	InviteLink string
}

type UserInvite

type UserInvite struct {
	Project          string
	Username         string
	RequestedBy      string
	RequestedByEmail string
	InviteLink       string
}

Jump to

Keyboard shortcuts

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