mail_test.go
796 字节
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
package common
import (
"testing"
)
//Example
func TestSendMail(t *testing.T) {
InitMailService(&MailConfig{
Host: "smtp.qq.com",
Port: 25,
From: "785410885@qq.com",
Password: "ibfduqhfmgypbffe", //授权码
TLS: false,
})
//SendMail(&MailContent{
// ToMail:"892423867@qq.com",
// Subject:"测试邮件",
// Body:[]byte("邮件内容..."),
//})
}
func TestSendMailTls(t *testing.T) {
InitMailService(&MailConfig{
Host: "smtp.qq.com",
Port: 465,
From: "785410885@qq.com",
Password: "ibfduqhfmgypbffe", //授权码
TLS: true,
})
//SendMail("892423867@qq.com","测试邮件",[]byte("邮件内容..."))
//SendMail(&MailContent{
// ToMail:"892423867@qq.com",
// Subject:"测试邮件",
// Body:[]byte("邮件内容..."),
//})
}