emaildelivery

package
v0.0.0-...-c7c8722 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2021 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ContentNameAttachments = "attachments"
View Source
var ContentNameBCC = "bcc"
View Source
var ContentNameCC = "cc"
View Source
var ContentNameFrom = "from"
View Source
var ContentNameHTML = "html"
View Source
var ContentNameReplyTo = "replyto"
View Source
var ContentNameSender = "sender"
View Source
var ContentNameSubject = "subject"
View Source
var ContentNameText = "text"
View Source
var ContentNameTo = "to"
View Source
var DeliveryType = "email"
View Source
var Factory = func(loader func(interface{}) error) (notificationdelivery.DeliveryDriver, error) {
	c := &Config{}
	err := loader(c)
	if err != nil {
		return nil, err
	}
	d := &Delivery{
		SMTP: c.SMTP,
	}
	return d, nil
}
View Source
var Fields = []*notificationdelivery.Field{
	{
		Name:    ContentNameFrom,
		Example: "NAME <mail@example.com>",
		Escape:  "",
	},
	{
		Name:    ContentNameSubject,
		Example: "EMAIL SUBJECT",
		Escape:  "",
	},
	{
		Name:    ContentNameTo,
		Example: `TONAME <to@example.com>,mail@example.com`,
		Escape:  "commaescape",
	},
	{
		Name:    ContentNameText,
		Example: "THIS IS A TEXT EMAIL\nLINE 2.",
		Escape:  "",
	},
	{
		Name:    ContentNameHTML,
		Example: "<p>\nTHIS IS A <b>HTML</b> EMAIL\n</p>",
		Escape:  "",
	},
	{
		Name:    ContentNameAttachments,
		Example: "[{\"Filename\":\"1.png\",\"DataURI\":\"https://URL\",\"ContentType\":\"image/png\"},{\"Filename\":\"2.png\",\"DataURI\":\"https://URL2\"}]",
		Escape:  "jsonescape",
	},
	{
		Name:    ContentNameReplyTo,
		Example: `REPLYTONAME <replyto@example.com>`,
		Escape:  "",
	},
	{
		Name:    ContentNameCC,
		Example: `CCNAME <cc@example.com>,mail@example.com`,
		Escape:  "commaescape",
	},
	{
		Name:    ContentNameBCC,
		Example: `BCCNAME <bcc@example.com>,mail@example.com`,
		Escape:  "commaescape",
	},
	{
		Name:    ContentNameSender,
		Example: "",
		Escape:  "",
	},
}
View Source
var RequeiredContent = []string{ContentNameTo}

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Filename    string
	DataURI     string
	ContentType string
}

type Config

type Config struct {
	SMTP SMTP
}

type Delivery

type Delivery struct {
	SMTP SMTP
}

func (*Delivery) CheckInvalidContent

func (d *Delivery) CheckInvalidContent(c notification.Content) ([]string, error)

CheckInvalidContent check if given content invalid Return invalid fields and any error raised

func (*Delivery) ContentFields

func (d *Delivery) ContentFields() []*notificationdelivery.Field

ContentFields return content fields Return invalid fields and any error raised

func (*Delivery) DeliveryType

func (d *Delivery) DeliveryType() string

func (*Delivery) MustEscape

func (d *Delivery) MustEscape(unescaped string) string

type SMTP

type SMTP struct {
	Sender string
	// Host smtp host addr
	Host string

	Port int
	// Identity user identity(user account) for stmp arddr
	Identity string
	//default email to address
	To string
	// email from address
	From string
	// Username email stmp user name
	Username string
	// Pasword email smtp password
	Password           string
	StartTLS           bool
	SSL                bool
	InsecureSkipVerify bool
}

func (*SMTP) NewEmail

func (s *SMTP) NewEmail(c notification.Content) (*email.Email, error)

func (*SMTP) Send

func (s *SMTP) Send(msg *email.Email) error

Jump to

Keyboard shortcuts

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