email

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package email provides an interface for sending emails, with implementations for Mailgun, Mailjet, Postmark, Resend, and SendGrid.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIToken

type APIToken string

APIToken is used to authenticate an email service.

type EmailBranding

type EmailBranding struct {
	CompanyName string
	LogoURL     string
}

EmailBranding holds app-specific branding used when building Hermes email templates.

type Emailer

type Emailer interface {
	SendEmail(ctx context.Context, details *OutboundEmailMessage) error
}

Emailer represents a service that can send emails.

type NoopEmailer

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

NoopEmailer doesn't send emails.

func NewNoopEmailer

func NewNoopEmailer() (*NoopEmailer, error)

NewNoopEmailer returns a new no-op NoopEmailer.

Example
package main

import (
	"context"
	"fmt"

	"github.com/verygoodsoftwarenotvirus/platform/v2/email"
)

func main() {
	emailer, err := email.NewNoopEmailer()
	if err != nil {
		panic(err)
	}

	err = emailer.SendEmail(context.Background(), &email.OutboundEmailMessage{
		ToAddress:   "user@example.com",
		ToName:      "User",
		FromAddress: "noreply@example.com",
		FromName:    "App",
		Subject:     "Welcome!",
		HTMLContent: "<h1>Hello</h1>",
	})

	fmt.Println(err)
}
Output:

<nil>

func (*NoopEmailer) SendEmail

SendEmail sends an email.

type OutboundEmailMessage

type OutboundEmailMessage struct {
	UserID      string
	ToAddress   string
	ToName      string
	FromAddress string
	FromName    string
	Subject     string
	HTMLContent string
	TestID      string `json:"testID,omitempty"`
}

OutboundEmailMessage is a collection of fields that are useful for sending emails.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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