tempmail

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package tempmail reads disposable inboxes from generator.email.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractCode

func ExtractCode(message Message) string

ExtractCode pulls a verification code from the subject or text body.

Types

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator is a client for generator.email. Call NewGenerator to construct it.

func NewGenerator

func NewGenerator(doer interface {
	Do(*http.Request) (*http.Response, error)
}) *Generator

func (*Generator) Domains

func (g *Generator) Domains(ctx context.Context) ([]string, error)

Domains lists the shared domains offered by generator.email.

func (*Generator) Generate

func (g *Generator) Generate(_ context.Context, domain string) (string, error)

Generate mints an address locally. Every address on the domain is already live.

func (*Generator) Messages

func (g *Generator) Messages(ctx context.Context, address string) ([]Message, error)

Messages reads an inbox and enriches the newest message with its HTML body.

func (*Generator) WaitForCode

func (g *Generator) WaitForCode(ctx context.Context, address string) (string, error)

WaitForCode polls an inbox until a verification code appears or ctx expires.

type Message

type Message struct {
	ID          int64     `json:"id"`
	Address     string    `json:"address"`
	FromAddress string    `json:"from"`
	Subject     string    `json:"subject"`
	TextBody    string    `json:"text_body"`
	HTMLBody    string    `json:"html_body"`
	ReceivedAt  time.Time `json:"received_at"`
	// contains filtered or unexported fields
}

Message is one received disposable email.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL