fallbackv1
import fallbackv1 "pocketone.dev/ext/contracts/mail/fallback/v1"
Package fallbackv1 is the mail.fallback/v1 contract: where an app's mail goes when its SMTP is off. Providers form an ordered chain (`providers: { mail.fallback/v1: [mailtrap, mailrelay] }` sets the order): each sends a message or passes it on with ErrPass; when every provider passes, PocketBase sends it its own way (sendmail).
Providers: mailtrap (dev mode: a local inbox), mailrelay (a multisite host's relay), or an app's own pb_hooks. Each provider calls Bind when it registers; Bind owns the app's mail hook, once.
Source: ext/contracts/mail/fallback/v1.
Variables
var Contract = extkit.NewContract[Sender]("mail.fallback/v1", extkit.Many).JS(extkit.JSOpen, func(o *extkit.JSObject) Sender { return jsSender{o} }).JSTypes(jsTypes)
Contract is mail.fallback/v1.
var ErrPass = errors.New("mail.fallback: passed")
ErrPass is a provider's "not mine": the next provider (or PocketBase) sends the message.
Functions
Bind
func Bind(app core.App)
Bind makes app's mail go through mail.fallback/v1's providers whenever its SMTP is off. Providers call it in Register; it binds the hook once per app, last (the app's own onMailerSend hooks run, and may change the message, first).
Types
Sender
type Sender interface {
// Send delivers m, or returns ErrPass to leave it to the next provider.
Send(ctx context.Context, m *mailer.Message) error
}
Sender delivers an app's mail when its SMTP is off.
Questions and comments
Comments are a GitHub Discussions thread; sign in with GitHub to post.