官方库

Go 电子邮件验证 SDK

EmailVerify.io 官方 Go 客户端,为分布式系统提供高并发、性能优化的电子邮件验证和潜在客户发现工具。

提供免费计划。无需信用卡。

sdk-example.worker

Go Get 设置

将 EmailVerify Go 客户端添加到您的项目依赖项中。

terminal
$ go get github.com/Clustox/emailverifygo

使用示例

1 实时验证

适用于 Go 的高性能电子邮件验证。我们的 SDK 设计轻量且快速,为实时验证提供线程安全的操作。

go
import "github.com/Clustox/emailverifygo"

client := emailverifygo.NewClient("your_api_key")
res, err := client.Validate("[email protected]")

if err == nil && res.Status == "valid" {
    fmt.Println("Safe to send!")
}

2 大批量提交

非阻塞地处理大规模数据集。Go 批处理客户端允许您提交大量的电子邮件以进行后台验证。

go
emails :=[]string{"[email protected]", "[email protected]"}
batch, _ := client.ValidateBatch(emails, "My Task")

// Poll or use webhooks
status, _ := client.GetTaskStatus(batch.TaskID)
if status.State == "finished" {
    results, _ := client.GetTaskResults(batch.TaskID)
    fmt.Printf("Processed %d emails\n", len(results))
}

3 高级客户端和上下文 (Context)

企业级配置。完全支持 Go 的 context 模式以实现取消和超时控制。

go
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()

// Advanced config with custom HTTP client
client := emailverifygo.NewClient("key")
client.HTTPClient.Timeout = 10 * time.Second

res, err := client.ValidateWithContext(ctx, "[email protected]")

4 AI 驱动的电子邮件查找器

专业的潜在客户发现。使用我们的 Finder API 根据姓名和域解析机构电子邮件地址。

go
lead, err := client.FindEmail("Larry Page", "google.com")

if err == nil && lead.Status == "found" {
    fmt.Printf("Found: %s (Confidence: %d%%)\n", lead.Email, lead.Confidence)
}

5 实时语法纠错

最大程度减少用户摩擦。实时自动检测并为常见的电子邮件拼写错误提供更正建议。

go
check, _ := client.ValidateSyntax("[email protected]")
if check.Suggestion != "" {
    fmt.Printf("Typo detected! Did you mean %s?\n", check.Suggestion)
}

6 并发批量验证

专为速度而打造。利用 Go 的 goroutine 并行执行多个实时验证。

go
var wg sync.WaitGroup
emails :=[]string{"[email protected]", "[email protected]", "[email protected]"}

for _, email := range emails {
    wg.Add(1)
    go func(e string) {
        defer wg.Done()
        res, _ := client.Validate(e)
        fmt.Println(res.Status)
    }(email)
}
wg.Wait()

7 强大的类型安全错误

优雅的错误管理。每次 API 故障都会作为结构化的错误类型返回,以便精确检测故障模式。

go
res, err := client.Validate(email)
if err != nil {
    if apiErr, ok := err.(*emailverifygo.APIError); ok {
        fmt.Printf("Status: %d, Message: %s", apiErr.Code, apiErr.Message)
    }
}

8 垃圾邮件和安全检测

保护您的声誉。在一次性电子邮件服务和已知的垃圾邮件陷阱接触您的服务器之前对其进行检测并阻止。

go
res, _ := client.Validate("[email protected]")
if res.IsDisposable || res.IsSpamTrap {
    log.Printf("High risk email: %s", res.Email)
}
fmt.Printf("Provider: %s", res.DomainInfo.Provider)
常见问题

常见问题解答

Question Icon

Go SDK 是线程安全的吗?

是的,Go 客户端被设计为线程安全,可以在多个 goroutine 之间安全共享。

Question Icon

如何在 Go SDK 中处理错误?

SDK 遵循标准 Go 错误处理模式。每个 API 方法都会返回一个结果和一个错误对象。

Question Icon

SDK 支持上下文 (context) 吗?

是的,我们最新的 Go SDK 支持上下文传播,使您能够有效地管理请求超时。

Question Icon

我可以使用它进行高并发验证吗?

绝对可以。Go SDK 针对高性能进行了优化,非常适合高并发微服务。

你只需点击一下即可获得干净的邮箱列表。

立即开始验证你的邮箱地址,提升营销活动的送达率

* 无需信用卡