forked from txthinking/x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
smtp_test.go
59 lines (54 loc) · 1.01 KB
/
smtp_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package ant
import(
"testing"
"net/mail"
)
func TestMakeBoundary(t *testing.T){
s := MakeBoundary()
t.Log(s)
}
func TestChunkSplit(t *testing.T){
s := `
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
ccccccccccccccccccccccccccccccccccccccc
`
s, err := ChunkSplit(s)
if err != nil{
t.Fatal(err)
}
t.Log(s)
}
func TestSendMail(t *testing.T){
p := ""
s := &SMTP{
"smtp.ym.163.com",
25,
"bot@ym.txthinking.com",
p,
false,
}
f := &mail.Address{
Name: "雷锋",
Address: "bot@ym.txthinking.com",
}
ts := []*mail.Address{
&mail.Address{
Name: "雷锋",
Address: "cloud@txthinking.com",
},
}
m := &Message{
From: f,
To: ts,
Subject: "hello",
Body: "哈哈",
Att: []string{
"/etc/hosts",
},
}
err := s.Send(m)
if err != nil{
t.Fatal(err)
}
}