sender

package
v0.0.0-...-3da28a4 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const TEMPLATE_DIR_PATH = "templates"

Variables

This section is empty.

Functions

func Template

func Template(path string, elements any) (string, error)

Types

type Mail

type Mail struct {
	EmailAddress string
	Subject      string

	PlainText string
	HTMLText  string
}

func NewMail

func NewMail(email string, subject string) *Mail

func (*Mail) AddContents

func (c *Mail) AddContents(plain string, html string) *Mail

func (*Mail) AddContentsFromTemplate

func (c *Mail) AddContentsFromTemplate(tempName string, elements any) (*Mail, error)

func (*Mail) Send

func (c *Mail) Send() error

Send mail via Mailgun

type SendForm

type SendForm struct {
	Name string
	Mail string
	Lang string

	Subject string
	Detail  string

	URL      string
	Category string

	Time time.Time
	IP   string

	CustomTitle string
	CustomValue string

	UserData *UserData
}

func (*SendForm) DiscordSender

func (f *SendForm) DiscordSender(webhook string) error

func (*SendForm) InsertDB

func (f *SendForm) InsertDB(ctx context.Context, db *db.DB, userId uint32) (*ent.Contact, error)

func (*SendForm) MailSender

func (f *SendForm) MailSender(mail string) error

func (*SendForm) SlackSender

func (f *SendForm) SlackSender(webhook string) error

type SlackDividerBlock

type SlackDividerBlock struct {
	Type string `json:"type"`
}

type SlackFiledBlock

type SlackFiledBlock struct {
	Type  string                `json:"type"`
	Filed []SlackPlainTextBlock `json:"fields"`
}

type SlackHeaderBlock

type SlackHeaderBlock struct {
	Type string              `json:"type"`
	Text SlackPlainTextBlock `json:"text,omitempty"`
}

type SlackPayload

type SlackPayload struct {
	Blocks []any `json:"blocks"`
}

type SlackPlainTextBlock

type SlackPlainTextBlock struct {
	Type  string `json:"type"`
	Text  string `json:"text,omitempty"`
	Emoji bool   `json:"emoji,omitempty"`
}

type SlackSectionBlock

type SlackSectionBlock struct {
	Type string              `json:"type"`
	Text SlackPlainTextBlock `json:"text,omitempty"`
}

type UserData

type UserData struct {
	Browser  string `json:"browser"`
	OS       string `json:"os"`
	Device   string `json:"device"`
	IsMobile bool   `json:"is_mobile"`
}

Jump to

Keyboard shortcuts

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