Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Test email flows in Go — OTPs and magic links auto-extracted. Zero dependencies, stdlib only.
go get github.com/zerodrop-dev/zerodrop-go
package main import ( "context" "fmt" "time" zerodrop "github.com/zerodrop-dev/zerodrop-go" ) func main() { client := zerodrop.New() inbox := client.GenerateInbox() // => "swift-x7k29a@zerodrop-sandbox.online" // Trigger your app's email flow with the inbox address... email, err := client.WaitForLatest(context.Background(), inbox, &zerodrop.Options{ Timeout: 15 * time.Second, }) if err != nil { panic(err) } fmt.Println(email.OTP) // "123456" — auto-extracted, no regex fmt.Println(email.MagicLink) // "https://..." — auto-extracted }
func TestSignupEmailVerification(t *testing.T) { client := zerodrop.New() inbox := client.GenerateInbox() // Trigger signup with the inbox address... email, err := client.WaitForLatest(context.Background(), inbox, &zerodrop.Options{ Timeout: 15 * time.Second, }) if err != nil { t.Fatalf("no verification email: %v", err) } if email.OTP == "" { t.Fatal("expected OTP in verification email") } }
WaitForLatest
// Force polling mode if needed email, err := client.WaitForLatest(ctx, inbox, &zerodrop.Options{ DisableSSE: true, })
email, err := client.WaitForLatest(ctx, inbox, &zerodrop.Options{ Timeout: 15 * time.Second, Filter: &zerodrop.Filter{ From: "noreply@yourapp.com", Subject: "Verify", HasOTP: zerodrop.Bool(true), }, })
GenerateInbox
t.Parallel()
func TestParallelSignups(t *testing.T) { t.Parallel() client := zerodrop.New() inbox := client.GenerateInbox() // unique per call // ... }
var timeoutErr *zerodrop.TimeoutError if errors.As(err, &timeoutErr) { // No email arrived } if errors.Is(err, zerodrop.ErrUnauthorized) { // Invalid API key }
client := zerodrop.New( zerodrop.WithAPIKey(os.Getenv("ZERODROP_API_KEY")), zerodrop.WithBaseURL("https://your-instance.yourdomain.com"), )