sendgrid

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: MIT Imports: 6 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BodyType added in v1.1.0

type BodyType int

BodyType is used to specify the format of the body.

const (
	// PlainText is used to specify that the body is plain text.
	PlainText BodyType = iota
	// HTML is used to specify that the body is HTML.
	HTML
)

type SendGrid

type SendGrid struct {
	// contains filtered or unexported fields
}

SendGrid struct holds necessary data to communicate with the SendGrid API.

func New

func New(apiKey, senderAddress, senderName string) *SendGrid

New returns a new instance of a SendGrid notification service. You will need a SendGrid API key. See https://sendgrid.com/docs/for-developers/sending-email/api-getting-started/

func (*SendGrid) AddReceivers

func (s *SendGrid) AddReceivers(addresses ...string)

AddReceivers takes email addresses and adds them to the internal address list. The Send method will send a given message to all those addresses.

func (*SendGrid) BodyFormat added in v1.1.0

func (s *SendGrid) BodyFormat(format BodyType)

BodyFormat can be used to specify the format of the body. Default BodyType is HTML.

func (SendGrid) Send

func (s SendGrid) Send(ctx context.Context, subject, message string) error

Send takes a message subject and a message body and sends them to all previously set chats. Message body supports html as markup language.

Jump to

Keyboard shortcuts

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