mailses

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package mailses provides an Amazon SES-backed mail driver.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Region               string
	AccessKeyID          string
	SecretAccessKey      string
	SessionToken         string
	Endpoint             string
	ConfigurationSetName string
	HTTPClient           *http.Client
}

Config configures Amazon SES delivery. @group SES

type Driver

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

Driver sends messages through Amazon SES. @group SES

func New

func New(settings Config) (*Driver, error)

New creates an Amazon SES mail driver from the given config. @group SES

Example: configure an Amazon SES mail driver

driver, _ := mailses.New(mailses.Config{
	Region:          "us-east-1",
	AccessKeyID:     "test",
	SecretAccessKey: "test",
})
fmt.Println(driver != nil)
// true
Example

ExampleNew demonstrates constructing an SES driver with an injected client.

package main

import (
	"fmt"

	"github.com/goforj/mail/mailses"
)

func main() {
	driver, _ := mailses.New(mailses.Config{
		Region:          "us-east-1",
		AccessKeyID:     "test",
		SecretAccessKey: "test",
	})

	fmt.Println(driver != nil)
}
Output:
true

func (*Driver) Send

func (d *Driver) Send(ctx context.Context, message mail.Message) error

Send validates and transmits one message through Amazon SES. @group SES

Example: send one message through Amazon SES

driver, _ := mailses.New(mailses.Config{
	Region:          "us-east-1",
	AccessKeyID:     "test",
	SecretAccessKey: "test",
	Endpoint:        "http://127.0.0.1:1",
})
err := driver.Send(context.Background(), mail.Message{
	From:    &mail.Recipient{Email: "no-reply@example.com"},
	To:      []mail.Recipient{{Email: "alice@example.com"}},
	Subject: "Welcome",
	Text:    "hello world",
})
fmt.Println(err == nil)
// false

Jump to

Keyboard shortcuts

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