Skip to content

About

Go port of @mailkite/mail-parse — failure-signature primitive (cross-language hash parity).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

MailKite

MailKite mail-parse (Go)

Deterministic, PII-free fingerprints for email parse failures — the same broken message yields the same hash in every language, so dedup and roll-up just work.

Docs · Libraries · TypeScript

CI Go Reference Go 1.21+ MIT

Read-only mirror. This repo is a generated, release-time mirror of the MailKite monorepo (the private source of truth) — development doesn't happen here. Install from Go modules and open issues against the MailKite docs.

Why

When a MIME message fails to parse, you want to know which class of failure it is — without ever touching the words, addresses, or subjects inside it. ComputeSignature turns a failure into a deterministic, PII-free fingerprint built only from structural features (scope, diagnostic codes, content type, transfer encoding, leading body bytes, header names, mailer family). The same failure produces the same FNV-1a hash in TypeScript, Python, and Go — byte-for-byte — so you can dedup across services, roll up "a whole class is failing" vs. a precise group, and feed both the cold-loop issue body and the hot-loop match from one fingerprint.

Install

go get github.com/mailkite/mail-parse-go

Quickstart

package main

import (
	"fmt"

	mailparse "github.com/mailkite/mail-parse-go"
)

func main() {
	sig := mailparse.ComputeSignature(mailparse.FailureEvent{
		Scope:            "part",
		DiagnosticCodes:  []string{"BOUNDARY_NOT_CLOSED"},
		ContentType:      "application/ms-tnef",
		TransferEncoding: "base64",
	})

	fmt.Println(sig.Hash) // f55154fda8f2cadd — same in TS, Python, and Go

	for _, r := range sig.Rollup {
		fmt.Printf("%-12s %s\n", r.Level, r.Hash) // scope → contentType → byteSignature → mailer
	}
}

ComputeSignature returns a FailureSignature with the finest-granularity Hash (the primary dedup key), the normalized Features, and a coarse-to-fine Rollup. The package also exports the building blocks Fnv1a64 and NormalizeMailer.

All MailKite libraries

Library Language Package
mail-parse TypeScript @mailkite/mail-parse
mail-parse-py Python mailkite-mail-parse
mail-parse-go Go github.com/mailkite/mail-parse-go

Docs & links

License

MIT — see LICENSE.

About

Go port of @mailkite/mail-parse — failure-signature primitive (cross-language hash parity).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages