百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

smtpd

> 编程语言
开源

一个用于处理 SMTP 服务器端的 Go 包,包含一个简单 SMTP 服务器示例

99 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

一个用于处理 SMTP 服务器端的 Go 包,包含一个简单 SMTP 服务器示例

Smtpd is a Go package for handling the server side of the SMTP protocol. It does not handle high level details like what addresses should be accepted or what should happen with email once it has been fully received; those decisions are instead delegated to whatever is driving smtpd. Smtpd's purpose is simply to handle the grunt work of a reasonably RFC compliant SMTP server, taking care of things like proper command sequencing, TLS, and basic correctness of some things.

(The standard library net/smtp package handles only the client side of SMTP; it makes no attempt to provide the facilities you'd need to write a server.)

smtpd sort of comes with a 'sinkhole' SMTP server that simply takes in email (perhaps) and doesn't do anything with it beyond perhaps writing it to disk. This is obviously not suitable for production usage but it does make a potentially useful sink for spammers (which is what the author uses it for). This once was cmd/sinksmtp.go, but has become so large and complicated that it has moved out to its own repository, https://github.com/siebenmann/sinksmtp.

Because of its origin as the core engine of a sinkhole SMTP server, smtpd is pretty casual about a lot of things in the SMTP protocol and in what information it hands to higher layers; for example, it basically ignores SMTP parameters on MAIL FROM and RCPT TO. It will accept far longer command lines than are required by the RFC, it has shorter timeouts than the RFC requires (although you can change that), and it is somewhat slapdash in doing basic sanity checking on addresses (the author declines to write an RFC 5321 address parser just to be fully correct, and yes it's a pity that this part of net/mail is not exported and no, we're not faking things up so we can use net/mail's version). These are all defects but the odds of the author fixing them are low because his sinkhole SMTP server doesn't currently need them.

(Pull requests are welcome.)

Smtpd supports PIPELINING by paying no attention to people who do it anyways and supports STARTTLS if you provide a certificate and a key. It advertises 8BITMIME and accepts the relevant MAIL FROM parameter; regardless of what clients do, messages are received in all 8 bits. It rejects VRFY and EXPN attempts. It supports AUTH if you configure one or more authentication methods.

References: http://tools.ietf.org/html/rfc5321 http://golang.org/pkg/net/smtp/

See also: https://github.com/flashmob/go-guerrilla

Go-Guerilla SMTPd requires a real database server and is less RFC neurotic than smtpd (eg it assumes that clients always send commands in the right order). It's also a monolithic program instead of a package that you can reuse.

CREDITS

Chris Siebenmann https://github.com/siebenmann started writing this.

Felix Lange https://github.com/fjl contributed SMTP AUTH support.

COPYRIGHT: GPL v3 for now

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Go

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言