Commit a1287516 authored by Alberto Bertogli's avatar Alberto Bertogli

smtpsrv: Test too many recipients

This patch adds a test to make sure we don't allow too many recipients.
parent 99c4ad5e
......@@ -270,6 +270,31 @@ func TestRelayForbidden(t *testing.T) {
}
}
func TestTooManyRecipients(t *testing.T) {
c := mustDial(t, ModeSubmission, true)
defer c.Close()
auth := smtp.PlainAuth("", "[email protected]", "testpasswd", "127.0.0.1")
if err := c.Auth(auth); err != nil {
t.Fatalf("Auth: %v", err)
}
if err := c.Mail("[email protected]"); err != nil {
t.Fatalf("Mail: %v", err)
}
for i := 0; i < 101; i++ {
if err := c.Rcpt(fmt.Sprintf("to%[email protected]", i)); err != nil {
t.Fatalf("Rcpt: %v", err)
}
}
err := c.Rcpt("[email protected]")
if err == nil || err.Error() != "452 4.5.3 Too many recipients" {
t.Errorf("Expected too many recipients, got: %v", err)
}
}
var str1MiB string
func sendLargeEmail(tb testing.TB, c *smtp.Client, sizeMiB int) error {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment