commit 927aaeadcff6a55416e1ef29faa7bbe90d63daea
Author: Hivert Quentin <quentin.hivert.fr@gmail.com>
Date:   Tue Jun 17 15:28:53 2025 +0200

    fix(smtp): allow smtp replies with only 3 chars (being the number code) instead of 4 (code + space)

diff --git a/sope-mime/NGMail/NGSmtpClient.m b/sope-mime/NGMail/NGSmtpClient.m
index fa0cfb3..c6ec39f 100644
--- a/sope-mime/NGMail/NGSmtpClient.m
+++ b/sope-mime/NGMail/NGSmtpClient.m
@@ -478,6 +478,19 @@
   NGSmtpReplyCode code  = -1;
 
   line = [self->text readLineAsString];
+  if([line length] == 3) {
+    //Invalid but can happen with some smtp server that does not follow correctly the smtp specs
+    //and only send the code number instead of the code + a space.
+    code = [[line substringToIndex:3] intValue];
+    if(code == 0)
+    {
+      NSLog(@"SMTP: reply has invalid format and is not a code of 3 chars (%@)", line);
+      return nil;
+    }
+    desc = [NSMutableString stringWithCapacity:[line length]];
+    return [NGSmtpResponse responseWithCode:code text:desc];
+  }
+
   if ([line length] < 4) {
     NSLog(@"SMTP: reply has invalid format (%@)", line);
     return nil;
