go-mail
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

欢迎使用 go-mail 文档

GoDoc codecov Go Report Card Crowdin GitHub release 在 Awesome Go 中提到 #go-mail on Discord REUSE status Mastodon Follow buy ma a coffee

go-mail logo

go-mail is an easy to use Go library for formating and sending mails. It uses idiomatic Go style and follows best practice with sane defaults. The library only dependends on the Go Standard Library. 它使用惯用的 Go 风格,并遵循最佳实践和合理的默认值。 它使用惯用的 Go 风格,并遵循最佳实践和合理的默认值。 该库仅依赖于 Go 标准库。

go-mail works like a programatic email client and provides lots of methods and functionalities you would consider standard in a MUA.

特色亮点

Standard Library dependant

go-mail 不需要任何第三方模块,仅运行在 Go 标准库上

现代、惯用的 Go

We are using modern and idiotmatic Go standards with this library and follow state-of-the-art best practices with sane defaults

完整的 TLS 支持

go-mail supports implicit STARTTLS with different policies as well as explicit SSL/TLS for connections to sending mail servers

上下文

我们利用 Go 上下文进行更好的控制流和超时/取消处理

SMTP 认证

Support for three common SMTP authentication mechanisms (LOGIN, PLAIN, CRAM-MD5) as well as custom authentications.

邮件地址验证

go-mail 遵循 RFC5322 并验证提供的邮件地址

常见邮件头支持

go-mail 提供了许多常见邮件头的生成器(Message-ID、Date、Bulk-Precedence、Priority 等)

连接重用

您可以在同一 SMTP 连接上发送多个邮件

附件/嵌入

来自不同来源(本地文件系统、io.Readerembed.FS)的附件和内联嵌入的完全支持

编码和内容类型

go-mail 支持不同的编码和内容类型

中间件

第三方库的中间件支持,以便更改邮件消息以满足其需求

Sendmail 和文件存储

支持通过本地 sendmail 安装发送邮件消息以及输出到本地文件(例如作为磁盘上的 .eml 文件以在 MUA 中打开它们) as .eml files to disk to open them in a MUA) 支持通过本地 sendmail 安装发送邮件消息以及输出到本地文件(例如作为磁盘上的 .eml 文件以在 MUA 中打开它们) as .eml files to disk to open them in a MUA) as .eml files to disk to open them in a MUA)

MDN 和 DSN

go-mail 提供了请求 MDN(RFC 8098)和 DSN(RFC 1891)的支持

模板支持

支持 Go 的 html/templatetext/template(作为消息正文、替代部分或附件/嵌入)

DKIM 支持

DKIM signature support via the go-mail-middlware/dkim middleware

调试日志记录

支持 SMTP 客户端将任何 SMTP 通信记录到 STDERR 以进行调试目的

自定义交付错误

With the SendError type the user is able to get detailed information about delivery errors including if the error is of temporary nature or not

支持

We have a support and general discussion channel on Discord. Find us at: #go-mail We have a support and general discussion channel on Discord. Find us at: #go-mail 找到我们:#go-mail We have a support and general discussion channel on Discord. Find us at: #go-mail 找到我们:#go-mail