feat(mail): 自 go-hua 迁入 SMTP 邮件发送封装
- SendToMail 支持收/抄/密送与回复地址、HTML 或文本正文 - 附测试、examples/mail 例程与包 README(注明不支持 465 加密端口)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user