+#ifdef WITH_CONTENT_SCAN
+if (spam_bar) spool_var_write(fp, US"spam_bar", spam_bar);
+if (spam_score) spool_var_write(fp, US"spam_score", spam_score);
+if (spam_score_int) spool_var_write(fp, US"spam_score_int", spam_score_int);
+#endif
+if (f.deliver_manual_thaw) fprintf(fp, "-manual_thaw\n");
+if (f.sender_set_untrusted) fprintf(fp, "-sender_set_untrusted\n");
+
+#ifdef EXPERIMENTAL_BRIGHTMAIL
+if (bmi_verdicts) spool_var_write(fp, US"bmi_verdicts", bmi_verdicts);
+#endif
+
+#ifndef DISABLE_TLS
+if (tls_in.certificate_verified) fprintf(fp, "-tls_certificate_verified\n");
+if (tls_in.cipher) spool_var_write(fp, US"tls_cipher", tls_in.cipher);
+if (tls_in.peercert)
+ {
+ if (tls_export_cert(big_buffer, big_buffer_size, tls_in.peercert))
+ fprintf(fp, "--tls_peercert %s\n", CS big_buffer);
+ }
+if (tls_in.peerdn) spool_var_write(fp, US"tls_peerdn", string_printing(tls_in.peerdn));
+if (tls_in.sni) spool_var_write(fp, US"tls_sni", string_printing(tls_in.sni));
+if (tls_in.ourcert)
+ {
+ if (tls_export_cert(big_buffer, big_buffer_size, tls_in.ourcert))
+ fprintf(fp, "-tls_ourcert %s\n", CS big_buffer);
+ }
+if (tls_in.ocsp) fprintf(fp, "-tls_ocsp %d\n", tls_in.ocsp);
+# ifndef DISABLE_TLS_RESUME
+fprintf(fp, "-tls_resumption %c\n", 'A' + tls_in.resumption);
+# endif
+if (tls_in.ver) spool_var_write(fp, US"tls_ver", tls_in.ver);
+#endif
+
+#ifdef SUPPORT_I18N
+if (message_smtputf8)
+ {
+ fprintf(fp, "-smtputf8\n");
+ if (message_utf8_downconvert)
+ fprintf(fp, "-utf8_%sdowncvt\n", message_utf8_downconvert < 0 ? "opt" : "");
+ }
+#endif
+
+/* Write the dsn flags to the spool header file */
+/* DEBUG(D_deliver) debug_printf("DSN: Write SPOOL: -dsn_envid %s\n", dsn_envid); */
+if (dsn_envid) fprintf(fp, "-dsn_envid %s\n", dsn_envid);
+/* DEBUG(D_deliver) debug_printf("DSN: Write SPOOL: -dsn_ret %d\n", dsn_ret); */
+if (dsn_ret) fprintf(fp, "-dsn_ret %d\n", dsn_ret);