email

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MailProviderDev   = "dev"
	MailProviderSES   = "ses"
	MailProviderLocal = "local"
)

Variables

This section is empty.

Functions

func BuildRawEmail added in v1.6.2

func BuildRawEmail(data SendMailData) ([]byte, error)

BuildRawEmail constructs a raw MIME email message from SendMailData. This is shared across all email implementations (Dev, SES, etc.) to ensure consistent email formatting and support for attachments and transactional flags.

func ExtractEmailAddress added in v1.6.2

func ExtractEmailAddress(email string) string

ExtractEmailAddress extracts the email address from a formatted string like "Name <email@example.com>" or returns the input if it's already just an email address

func StripHTML

func StripHTML(s string) string

StripHTML returns a version of a string with no HTML tags.

Types

type AWSSES

type AWSSES struct{}

func (AWSSES) Send

func (AWSSES) Send(data SendMailData) error

type Attachment added in v1.6.2

type Attachment struct {
	URL         string `json:"url"`         // URL where the attachment was fetched from
	Body        []byte `json:"body"`        // Raw bytes of the attachment
	ContentType string `json:"contentType"` // MIME type of the attachment
	Filename    string `json:"filename"`    // Name of the file
}

Attachment represents an email attachment

type Dev

type Dev struct{}

func (Dev) Send

func (Dev) Send(data SendMailData) error

type Local added in v1.6.2

type Local struct{}

func (Local) Send added in v1.6.2

func (Local) Send(data SendMailData) error

type Mailer added in v1.4.1

type Mailer interface {
	// Send sends the email
	Send(SendMailData) error
}

Mailer is used to have different implementation for sending email

type SendMailData added in v1.4.1

type SendMailData struct {
	From     string `json:"from"`
	FromName string `json:"fromName"`
	To       string `json:"to"`
	ToName   string `json:"toName"`
	Subject  string `json:"subject"`
	HTMLBody string `json:"htmlBody"`
	TextBody string `json:"textBody"`
	ReplyTo  string `json:"replyTo"`

	Body string `json:"body"`

	Attachments     []Attachment `json:"attachments"`
	IsTransactional bool         `json:"isTransactional"`
}

SendMailData contains necessary fields to send an email

Jump to

Keyboard shortcuts

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