email

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetContentHashBase64

func GetContentHashBase64(content []byte) string

func GetHmac

func GetHmac(content string, key []byte) string

Types

type Attachment

type Attachment struct {
	Content        string `json:"contentBytesBase64"`
	AttachmentType string `json:"attachmentType"`
	Name           string `json:"name"`
}

type AzureACSEmailProvider

type AzureACSEmailProvider struct {
	AccessKey string
	Endpoint  string
}

func NewAzureACSEmailProvider

func NewAzureACSEmailProvider(accessKey string, endpoint string) *AzureACSEmailProvider

func (*AzureACSEmailProvider) Send

func (a *AzureACSEmailProvider) Send(fromAddress string, fromName string, toAddress string, subject string, content string) error

type CommunicationError

type CommunicationError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

CommunicationError contains the error code and message

type Content

type Content struct {
	Subject   string `json:"subject"`
	HTML      string `json:"html"`
	PlainText string `json:"plainText"`
}

type CustomHeader

type CustomHeader struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type Email

type Email struct {
	Recipients    Recipients     `json:"recipients"`
	SenderAddress string         `json:"senderAddress"`
	Content       Content        `json:"content"`
	Headers       []CustomHeader `json:"headers"`
	Tracking      bool           `json:"disableUserEngagementTracking"`
	Importance    string         `json:"importance"`
	ReplyTo       []EmailAddress `json:"replyTo"`
	Attachments   []Attachment   `json:"attachments"`
}

type EmailAddress

type EmailAddress struct {
	DisplayName string `json:"displayName"`
	Address     string `json:"address"`
}

type EmailProvider

type EmailProvider interface {
	Send(fromAddress string, fromName, toAddress string, subject string, content string) error
}

func GetEmailProvider

func GetEmailProvider(typ string, clientId string, clientSecret string, host string, port int, disableSsl bool, endpoint string, method string) EmailProvider

type ErrorResponse

type ErrorResponse struct {
	Error CommunicationError `json:"error"`
}

type HttpEmailProvider

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

func NewHttpEmailProvider

func NewHttpEmailProvider(endpoint string, method string) *HttpEmailProvider

func (*HttpEmailProvider) Send

func (c *HttpEmailProvider) Send(fromAddress string, fromName string, toAddress string, subject string, content string) error

type Recipients

type Recipients struct {
	To  []EmailAddress `json:"to"`
	CC  []EmailAddress `json:"cc"`
	BCC []EmailAddress `json:"bcc"`
}

type SendgridEmailProvider

type SendgridEmailProvider struct {
	ApiKey string
}

func NewSendgridEmailProvider

func NewSendgridEmailProvider(apiKey string) *SendgridEmailProvider

func (*SendgridEmailProvider) Send

func (s *SendgridEmailProvider) Send(fromAddress string, fromName, toAddress string, subject string, content string) error

type SendgridResponseBody

type SendgridResponseBody struct {
	Errors []struct {
		Message string      `json:"message"`
		Field   interface{} `json:"field"`
		Help    interface{} `json:"help"`
	} `json:"errors"`
}

type SmtpEmailProvider

type SmtpEmailProvider struct {
	Dialer *gomail.Dialer
}

func NewSmtpEmailProvider

func NewSmtpEmailProvider(userName string, password string, host string, port int, typ string, disableSsl bool) *SmtpEmailProvider

func (*SmtpEmailProvider) Send

func (s *SmtpEmailProvider) Send(fromAddress string, fromName string, toAddress string, subject string, content string) error

Jump to

Keyboard shortcuts

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