--- dovecot.c.old	2025-02-03 09:33:39.474726040 +0200
+++ dovecot.c	2025-02-03 09:35:47.523761012 +0200
@@ -253,6 +253,7 @@
 uschar buffer[DOVECOT_AUTH_MAXLINELEN];
 uschar *args[DOVECOT_AUTH_MAXFIELDCOUNT];
 uschar *auth_command;
+uschar *version_command;
 uschar *auth_extra_data = US"";
 uschar *p;
 int nargs, tmp;
@@ -334,6 +335,19 @@
     CHECK_COMMAND("VERSION", 2, 2);
     if (Uatoi(args[1]) != VERSION_MAJOR)
       OUT("authentication socket protocol version mismatch");
+
+    version_command = string_sprintf("VERSION\t%d\t%d\n",
+	   VERSION_MAJOR, VERSION_MINOR);
+    
+    if ((
+    #ifndef DISABLE_TLS
+	cctx.tls_ctx ? tls_write(cctx.tls_ctx, version_command, Ustrlen(version_command), FALSE) :
+    #endif
+	write(cctx.sock, version_command, Ustrlen(version_command))) < 0)
+      HDEBUG(D_auth) debug_printf("error sending version_command: %s\n",
+	strerror(errno));
+    
+    HDEBUG(D_auth) debug_printf("  DOVECOT>> '%s'\n", version_command);
     }
   else if (Ustrcmp(args[0], US"MECH") == 0)
     {
@@ -409,9 +423,9 @@
 cert" when relevant.
 ****************************************************************************/
 
-auth_command = string_sprintf("VERSION\t%d\t%d\nCPID\t%d\n"
+auth_command = string_sprintf("CPID\t%d\n"
        "AUTH\t%d\t%s\tservice=smtp\t%srip=%s\tlip=%s\tnologin\tresp=%s\n",
-       VERSION_MAJOR, VERSION_MINOR, getpid(), crequid,
+       getpid(), crequid,
        ablock->public_name, auth_extra_data, sender_host_address,
        interface_address, data);
 
