Go用メール検証SDK
無料プランが利用可能です。クレジットカードは不要です。
Go Getセットアップ
EmailVerify Go クライアントをプロジェクトの依存関係に追加します。
go get github.com/Clustox/emailverifygo
使用サンプル
1 リアルタイム検証
Go 向けの高性能メール検証。当社の SDK は軽量かつ高速に設計されており、リアルタイム検証のためのスレッドセーフな操作を提供します。
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 バッチクライアントを使用すると、バックグラウンド検証のためにメールの大きなスライスを送信できます。
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 高度なクライアントとコンテキスト
エンタープライズ対応の設定。キャンセルとタイムアウトのための Go の Context パターンを完全にサポートしています。
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 を使用して、名前とドメインから組織のメールアドレスを解決します。
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 リアルタイムの構文修正
ユーザーの摩擦を最小限に抑えます。一般的なメールの入力ミスをリアルタイムで自動的に検出し、修正を提案します。
check, _ := client.ValidateSyntax("[email protected]")
if check.Suggestion != "" {
fmt.Printf("Typo detected! Did you mean %s?\n", check.Suggestion)
}
6 並行バッチ検証
スピードのために構築されています。Go の goroutine を活用して、複数のリアルタイム検証を並行して実行します。
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 エラーは構造化されたエラー型として返されるため、正確な障害モードの検出が可能です。
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 スパムとセキュリティの検出
レピュテーションを保護します。使い捨てのメールサービスや既知のスパムトラップがサーバーに接触する前に検出し、ブロックします。
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)
よくある質問
Go SDK はスレッドセーフですか?
はい、Go クライアントはスレッドセーフになるように設計されており、複数の goroutine 間で安全に共有できます。
Go SDK でエラーを処理するにはどうすればよいですか?
SDK は標準の Go エラー処理パターンに従います。すべての API メソッドは、結果とエラーオブジェクトを返します。
SDK はコンテキストをサポートしていますか?
はい、最新の Go SDK はコンテキストの伝播をサポートしており、リクエストのタイムアウトを効果的に管理できます。
高並行性の検証に使用できますか?
もちろんです。Go SDK は高性能に最適化されており、高並行性のマイクロサービスに最適です。