mail.fallback/v1
Where an app's mail goes when its SMTP is off. Providers form an ordered chain: each sends a message or passes it on;
when all pass, PocketBase sends it its own way (sendmail). An app with SMTP on never reaches the chain.
A service (fallback.go), many providers, open to pb_hooks.
Use
Nothing to call: mail an app sends with SMTP off goes through the chain. Order the providers in pocketone.yaml:
providers:
mail.fallback/v1: [mailtrap, mailrelay]
Provide
Implement fallbackv1.Sender (Send(ctx, *mailer.Message), returning fallbackv1.ErrPass to pass), provide it,
and bind the chain once:
fallbackv1.Contract.Provide(app, mySender{})
fallbackv1.Bind(app)
From pb_hooks:
onContracts((e) => {
e.provide("mail.fallback/v1", {
send(m) {
if (!m.to.some((a) => a.address.endsWith("@example.com"))) throw new ContractError("pass")
// send it your way
},
})
e.next()
})
Extensions
| Extension | |
|---|---|
| mailrelay | provides |
| mailtrap | provides |
License
MIT
Questions and comments
Comments are a GitHub Discussions thread; sign in with GitHub to post.