Files
zeekayandHanzo Dev 15909c7b79 Rename Go module path to github.com/hanzoai/mail
Fork of github.com/mjl-/mox at 5656ca6d1b
(upstream v0.0.15 plus 55 commits).

Rename the module path in go.mod and the import paths in 268 Go files. Also
update the five scripts that "go install" the module (genwebsite.sh,
docker-release.sh, apidiff.sh, test-upgrade.sh, Dockerfile.release), which
would otherwise build upstream rather than this fork.

Add NOTICE recording the upstream project, author, license, and fork point,
and stating which license covers which files: MIT for the mox source and our
changes, MPL-2.0 for publicsuffix/public_suffix_list.txt alone, and the
vendored dependencies' own licenses under licenses/. Embed NOTICE so
"mail licenses" prints the lineage from the running binary. LICENSE.MIT,
LICENSE.MPLv2.0 and the licenses/ tree are preserved verbatim; no code is
relicensed.

The mox command name, config keys, data directory layout and website content
are unchanged. LLM.md records the fork point, the rename, what was left alone,
and the steps to stand the server up.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-27 23:16:19 -07:00

40 lines
1.1 KiB
Go

package smtpserver
import (
"fmt"
"github.com/hanzoai/mail/smtp"
)
func xcheckf(err error, format string, args ...any) {
if err != nil {
err := fmt.Errorf("%s: %w", fmt.Sprintf(format, args...), err)
panic(smtpError{smtp.C451LocalErr, smtp.SeSys3Other0, err.Error(), err, true, false})
}
}
type smtpError struct {
code int
secode string
errmsg string // Sent in response.
err error // If set, used in logging. Typically has same information as errmsg.
printStack bool
userError bool // If this is an error on the user side, which causes logging at a lower level.
}
func (e smtpError) Error() string { return e.errmsg }
func (e smtpError) Unwrap() error { return e.err }
func xsmtpErrorf(code int, secode string, userError bool, format string, args ...any) {
err := fmt.Errorf(format, args...)
panic(smtpError{code, secode, err.Error(), err, false, userError})
}
func xsmtpServerErrorf(codes codes, format string, args ...any) {
xsmtpErrorf(codes.code, codes.secode, false, format, args...)
}
func xsmtpUserErrorf(code int, secode string, format string, args ...any) {
xsmtpErrorf(code, secode, true, format, args...)
}