emailgateway

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PriorityLow  priority = "LOW"
	PriorityHigh priority = "HIGH"
)

Variables

View Source
var (
	ErrUnableToSendEmail = errors.New("unable to send email")
)

Functions

This section is empty.

Types

type Address

type Address struct {
	Email string `json:"email"`
	Name  string `json:"name"`
}

type Attachment

type Attachment struct {
	Filename string `json:"fileName"`
	// Content is the base64 encoded content of the attachment
	Content     string      `json:"content"`
	ContentType ContentType `json:"contentType"`
	ContentID   string      `json:"contentId"`
}

type Client

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

func NewClient

func NewClient(config Config) (*Client, error)

func (*Client) SendMarketingEmail

func (c *Client) SendMarketingEmail(email Email) (*SendEmailResponse, error)

func (*Client) SendTransactionalEmail

func (c *Client) SendTransactionalEmail(email Email) (*SendEmailResponse, error)

type Config

type Config struct {
	ProductToken                 string
	CustomHttpClient             *http.Client
	DefaultTransactionalPriority priority
}

type ContentType

type ContentType string
const (
	ContentTypePNG  ContentType = "image/png"
	ContentTypeJPG  ContentType = "image/jpg"
	ContentTypeJPEG ContentType = "image/jpeg"
	ContentTypePDF  ContentType = "application/pdf"
	ContentTypeDoc  ContentType = "application/doc"
	ContentTypeDocx ContentType = "application/docx"
	ContentTypeText ContentType = "application/zip"
)

type Email

type Email struct {
	From              Address      `json:"from"`
	ReplyTo           *Address     `json:"replyTo,omitempty"`
	To                []Address    `json:"to"`
	Cc                []Address    `json:"cc,omitempty"`
	Bcc               []Address    `json:"bcc,omitempty"`
	Subject           string       `json:"subject"`
	HTMLBody          string       `json:"html"`
	TextBody          string       `json:"text"`
	Attachments       []Attachment `json:"attachments,omitempty"`
	CustomerReference string       `json:"customerReference,omitempty"`
	Priority          priority     `json:"-"`
}

type SendEmailResponse

type SendEmailResponse struct {
	Status    int    `json:"status"`
	Message   string `json:"message"`
	Success   bool   `json:"success"`
	MessageID string `json:"messageId"`
}

type WebhookEvent

type WebhookEvent string
const (
	WebhookEventDelivered    WebhookEvent = "Delivered"
	WebhookEventOpened       WebhookEvent = "Opened"
	WebhookEventClicked      WebhookEvent = "Clicked"
	WebhookEventBounced      WebhookEvent = "Bounced"
	WebhookEventUnsubscribed WebhookEvent = "Unsubscribed"
	WebhookEventComplained   WebhookEvent = "Complained"
)

Jump to

Keyboard shortcuts

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