brevo

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package brevo provides a client for the Brevo (Sendinblue) transactional email API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	Name    string // Filename
	Content string // Base64 encoded content
	URL     string // URL to fetch the attachment from (alternative to Content)
}

Attachment represents an email attachment.

type Client

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

Client is a Brevo API client.

func NewClient

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

NewClient creates a new Brevo client.

func (*Client) GetEmailStatus

func (c *Client) GetEmailStatus(ctx context.Context, messageID string) (*EmailStatus, error)

GetEmailStatus retrieves the status of a sent email by message ID.

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

Ping verifies the API connection by checking the account.

func (*Client) SendTemplateEmail

func (c *Client) SendTemplateEmail(ctx context.Context, email *TemplateEmail) (string, error)

SendTemplateEmail sends an email using a Brevo template.

func (*Client) SendTransactionalEmail

func (c *Client) SendTransactionalEmail(ctx context.Context, email *TransactionalEmail) (string, error)

SendTransactionalEmail sends a transactional email using the Brevo API.

type Config

type Config struct {
	APIKey         string
	DefaultSender  EmailAddress
	TimeoutSeconds int
	BaseURL        string // Optional, defaults to Brevo API
}

Config holds the configuration for the Brevo client.

type EmailAddress

type EmailAddress struct {
	Name  string `json:"name,omitempty"`
	Email string `json:"email"`
}

EmailAddress represents an email address with an optional name.

type EmailEvent

type EmailEvent struct {
	Event     string
	Timestamp time.Time
}

EmailEvent represents a single event in an email's lifecycle.

type EmailStatus

type EmailStatus struct {
	MessageID string
	Status    string // "sent", "delivered", "opened", "bounced", "failed"
	Events    []EmailEvent
}

EmailStatus represents the status of a sent email.

type TemplateEmail

type TemplateEmail struct {
	To         []EmailAddress
	TemplateID int64
	Params     map[string]interface{}
	Sender     *EmailAddress
	Tags       []string
}

TemplateEmail represents an email to be sent using a Brevo template.

type TransactionalEmail

type TransactionalEmail struct {
	To          []EmailAddress
	Cc          []EmailAddress
	Bcc         []EmailAddress
	Subject     string
	HTMLContent string
	TextContent string
	Sender      *EmailAddress
	ReplyTo     *EmailAddress
	Attachments []Attachment
	Headers     map[string]string
	Tags        []string
}

TransactionalEmail represents a transactional email to be sent.

Jump to

Keyboard shortcuts

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