diff --git a/imapserver/search.go b/imapserver/search.go index 46daa4e..c58aec9 100644 --- a/imapserver/search.go +++ b/imapserver/search.go @@ -128,6 +128,11 @@ func (c *conn) cmdxSearch(isUID bool, tag, cmd string, p *parser) { }) if eargs == nil { + // In IMAP4rev1, an untagged SEARCH response is required. ../rfc/3501:2728 + if len(uids) == 0 { + c.bwritelinef("* SEARCH") + } + // Old-style SEARCH response. We must spell out each number. So we may be splitting // into multiple responses. ../rfc/9051:6809 ../rfc/3501:4833 for len(uids) > 0 { diff --git a/imapserver/search_test.go b/imapserver/search_test.go index 25b94b9..47128f0 100644 --- a/imapserver/search_test.go +++ b/imapserver/search_test.go @@ -36,10 +36,6 @@ this is html. func (tc *testconn) xsearch(nums ...uint32) { tc.t.Helper() - if len(nums) == 0 { - tc.xnountagged() - return - } tc.xuntagged(imapclient.UntaggedSearch(nums)) }