emailvalidator

package
v0.0.0-...-9944d71 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config = MordibouncerConfig

Config is an alias for backward compatibility Deprecated: Use MordibouncerConfig instead

type MordibouncerConfig

type MordibouncerConfig struct {
	APIURL        string // e.g., "https://mailexchange.kremlit.dev"
	APIKey        string // x-mordibouncer-secret header value
	Timeout       time.Duration
	ProxyProvider ProxyProvider // Optional: function to get proxy from database
}

MordibouncerConfig for Mordibouncer validator

type MordibouncerValidator

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

MordibouncerValidator validates emails using Mordibouncer API (Note: The struct name intentionally matches the API service name "Mordibouncer")

func NewMordibouncerValidator

func NewMordibouncerValidator(cfg MordibouncerConfig) *MordibouncerValidator

NewMordibouncerValidator creates a new Mordibouncer validator

func NewMoribouncerValidator

func NewMoribouncerValidator(cfg Config) *MordibouncerValidator

NewMoribouncerValidator is an alias for backward compatibility Deprecated: Use NewMordibouncerValidator instead

func (*MordibouncerValidator) Validate

func (v *MordibouncerValidator) Validate(ctx context.Context, email string) (*ValidationResult, error)

Validate validates a single email using Mordibouncer API

func (*MordibouncerValidator) ValidateBatch

func (v *MordibouncerValidator) ValidateBatch(ctx context.Context, emails []string) (map[string]*ValidationResult, error)

ValidateBatch validates multiple emails

type NoOpValidator

type NoOpValidator struct{}

NoOpValidator is a validator that accepts all emails (for testing/disabled mode)

func (*NoOpValidator) Validate

func (v *NoOpValidator) Validate(_ context.Context, email string) (*ValidationResult, error)

Validate always returns a valid result for NoOpValidator

type ProxyConfig

type ProxyConfig struct {
	Host string `json:"host"`
	Port int    `json:"port"`
}

ProxyConfig for SOCKS5 proxy support in Mordibouncer requests

type ProxyProvider

type ProxyProvider func(ctx context.Context) (host string, port int, err error)

ProxyProvider is a function that returns a proxy for SMTP checks Returns host, port, or empty/0 if no proxy available

type ValidationResult

type ValidationResult struct {
	Email       string  `json:"email"`
	Status      string  `json:"status"` // valid, invalid, unknown, catch_all
	Score       float64 `json:"score"`  // 0-100
	Deliverable bool    `json:"deliverable"`
	Disposable  bool    `json:"disposable"`
	RoleAccount bool    `json:"role_account"` // info@, support@, etc.
	FreeEmail   bool    `json:"free_email"`   // gmail, yahoo, etc.
	CatchAll    bool    `json:"catch_all"`    // accepts any email
	Reason      string  `json:"reason"`
}

ValidationResult from email validation API

func (*ValidationResult) ShouldAccept

func (r *ValidationResult) ShouldAccept() bool

ShouldAccept returns true if email is acceptable for leads Accepts: valid emails, catch_all, and unknown (when SMTP unreachable)

func (*ValidationResult) ShouldAcceptRelaxed

func (r *ValidationResult) ShouldAcceptRelaxed() bool

ShouldAcceptRelaxed returns true with more relaxed criteria (allows role accounts and catch-all domains)

type Validator

type Validator interface {
	Validate(ctx context.Context, email string) (*ValidationResult, error)
}

Validator interface for email validation

Jump to

Keyboard shortcuts

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