email

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Send

func Send(m *Mail) (err error)

Send an email with smtp protocol.

Types

type Attachment

type Attachment struct {
	Filename string
	Data     []byte
	Inline   bool
}

Attachment represents an email attachment.

type Header struct {
	Key   string
	Value string
}

Header represents an additional email header.

type Mail

type Mail struct {
	Message *Message
	Schema  string
	Reply   bool
}

Mail contains email information that needs to be sent

type Message

type Message struct {
	To          []*mail.Address
	Cc          []*mail.Address
	Bcc         []*mail.Address
	ReplyTo     string
	Subject     string
	Body        string
	BodyType    string
	Headers     []Header
	Attachments map[string]*Attachment
}

Message represents a smtp message.

func HTMLMessage

func HTMLMessage(subject string, body string) *Message

HTMLMessage returns a new Message that can compose an HTML email with attachments

func TextMessage

func TextMessage(subject string, body string) *Message

TextMessage returns a new Message that can compose an email with attachments

func (*Message) AddBcc

func (m *Message) AddBcc(address *mail.Address) []*mail.Address

AddBcc a bcc recipient

func (*Message) AddCc

func (m *Message) AddCc(address *mail.Address) []*mail.Address

AddCc a cc recipient

func (*Message) AddHeader

func (m *Message) AddHeader(key string, value string) Header

AddHeader a Header to message

func (*Message) AddTo

func (m *Message) AddTo(address *mail.Address) []*mail.Address

AddTo a recipient

func (*Message) Attach

func (m *Message) Attach(file string) error

Attach attaches a file.

func (*Message) AttachBuffer

func (m *Message) AttachBuffer(filename string, buf []byte, inline bool) error

AttachBuffer attaches a binary attachment.

func (*Message) Inline

func (m *Message) Inline(file string) error

Inline includes a file as an inline attachment.

Jump to

Keyboard shortcuts

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