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 EmailBranding ¶
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 ¶
func (e *NoopEmailer) SendEmail(context.Context, *OutboundEmailMessage) error
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.
Click to show internal directories.
Click to hide internal directories.