feat(mail): 自 go-hua 迁入 SMTP 邮件发送封装

- SendToMail 支持收/抄/密送与回复地址、HTML 或文本正文
- 附测试、examples/mail 例程与包 README(注明不支持 465 加密端口)
This commit is contained in:
2026-09-20 12:29:38 +08:00
parent 9ff1a0e816
commit a6ba78c92c
4 changed files with 133 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
package mail
import "testing"
func TestMergeSlice(t *testing.T) {
got := MergeSlice([]string{"a@t.com", "b@t.com"}, []string{"c@t.com"})
if len(got) != 3 {
t.Fatalf("MergeSlice 长度 = %d, want 3", len(got))
}
want := map[string]bool{"a@t.com": true, "b@t.com": true, "c@t.com": true}
for _, s := range got {
if !want[s] {
t.Errorf("MergeSlice 结果包含意外元素 %q", s)
}
}
}
func TestMergeSliceEmpty(t *testing.T) {
if got := MergeSlice(nil, nil); len(got) != 0 {
t.Errorf("空输入 MergeSlice = %v, want 空", got)
}
}