ok, I created a test email account on a domain that has an account that fails.
The new account works ok, I have been able to send and receive from this test account.
So this would point to either the number of emails in the account being a problem, the mailbox size, the content in the emails, the account cache (if that's stored somewhere even when the account is deleted?) or something else?
But they only fail in Apple Mail and only the SM email accounts (apart from the test one I set up), I've tried various other mail clients and they all work fine with these accounts.
Looking in the IMAP logs I have this recorded a few times:
[2023.01.25] 12:42:44.525 [myip] Failed to fetch data item 29126 in 'ENVELOPE' for myemailaddress in Spam-Hi.
[2023.01.25] System.Exception: angled address does not end.
[2023.01.25] at MailService.GroupFileAccess.RFC2822Helper.GetAngledAddressEndIndex(String text, Int32 startIndex)
[2023.01.25] at MailService.GroupFileAccess.RFC2822AddressLine.Parse()
[2023.01.25] at MailService.Protocols.IMAP.ImapMessageWrapper.AddressWrap(String address)
[2023.01.25] at MailService.Protocols.IMAP.ImapMessageWrapper.GetEnvelope(RFC2822Header header, String& partValue)
[2023.01.25] at MailService.Protocols.IMAP.ImapMessageWrapper.GetPart(User user, String partItem)
[2023.01.25] at MailService.TcpServerLib.IMAP.IMAPSession.FetchDataItems(List`1 idList, List`1 itemList, Nullable`1 changedSince, List`1& replyArr)
[2023.01.25] 12:42:44.541 [18.104.22.168] disconnected at 1/25/2023 12:42:44 PM