You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
772 B

package smtpd_test
import (
"fmt"
"testing"
"git.watsonserve.com/maild/base"
"git.watsonserve.com/maild/smtpd"
"github.com/watsonserve/goutils"
)
type SmtpConf struct{}
func (sc *SmtpConf) GetConfig() *base.ServerConfig {
return &base.ServerConfig{
Domain: "watsonserve.com",
Ip: "127.0.0.1",
Type: "SMTP",
Name: "WS_SMTPD",
Version: "1.0",
}
}
func (sc *SmtpConf) Auth(username string, password string) string {
fmt.Printf("%s %s\n", username, password)
return "null"
}
func (sc *SmtpConf) TakeOff(email *base.Mail) {
fmt.Println(email.Head, email.MailContent)
}
func TestExample(t *testing.T) {
ln, err := goutils.Socket(":10025")
if nil != err {
t.Log(err)
}
t.Log("listen on port 10025")
smtpd.Service(ln, &SmtpConf{})
}