type testServer struct {
EmptyServerCallbacks
+ domain string
blockList []string
tlsConfig *tls.Config
*userAuth
}
func (s *testServer) VerifyAddress(addr mail.Address) ReplyLine {
+ if DomainForAddress(addr) != s.domain {
+ return ReplyBadMailbox
+ }
for _, block := range s.blockList {
if strings.ToLower(block) == addr.Address {
return ReplyBadMailbox
// RFC 5321 ยง D.1
func TestScenarioTypical(t *testing.T) {
s := testServer{
+ domain: "foo.com",
blockList: []string{"Green@foo.com"},
}
l := runServer(t, &s)
func TestVerifyAddress(t *testing.T) {
s := testServer{
+ domain: "test.mail",
blockList: []string{"banned@test.mail"},
}
l := runServer(t, &s)
}
func TestCaseSensitivty(t *testing.T) {
- s := &testServer{}
- s.blockList = []string{"reject@mail.com"}
+ s := &testServer{
+ domain: "mail.com",
+ blockList: []string{"reject@mail.com"},
+ }
l := runServer(t, s)
defer l.Close()