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 ¶
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 ¶
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
Click to show internal directories.
Click to hide internal directories.