diff -ur sendmail-8.13.8-orig/cf/m4/proto.m4 sendmail-8.13.8-qbexp/cf/m4/proto.m4
--- sendmail-8.13.8-orig/cf/m4/proto.m4	2006-03-30 15:50:13.000000000 -0500
+++ sendmail-8.13.8-qbexp/cf/m4/proto.m4	2006-11-20 15:34:39.000000000 -0500
@@ -390,6 +390,10 @@
 # how many jobs can you process in the queue?
 _OPTION(MaxQueueRunSize, `confMAX_QUEUE_RUN_SIZE', `0')
 
+ifdef(`_FFR_QUEUE_SAVEFILES_OPTION',`dnl
+# leave behind queue files when done?
+_OPTION(QueueSaveFiles, `confQUEUE_SAVE_FILES', `')')
+
 # perform initial split of envelope without checking MX records
 _OPTION(FastSplit, `confFAST_SPLIT', `1')
 
diff -ur sendmail-8.13.8-orig/sendmail/conf.c sendmail-8.13.8-qbexp/sendmail/conf.c
--- sendmail-8.13.8-orig/sendmail/conf.c	2006-03-22 17:49:33.000000000 -0500
+++ sendmail-8.13.8-qbexp/sendmail/conf.c	2006-11-20 15:10:01.000000000 -0500
@@ -6292,6 +6300,14 @@
 	/* Additional checks when doing queue runs; interval of checks */
 	"_FFR_QUEUE_RUN_PARANOIA",
 #endif /* _FFR_QUEUE_RUN_PARANOIA */
+#if _FFR_QUEUE_SAVEFILES_OPTION
+	/* provide option QueueSaveFiles so that queue files are saved after successfull delivery */
+	"_FFR_QUEUE_SAVEFILES_OPTION",
+#endif /* _FFR_QUEUE_SAVEFILES_OPTION */
+#if _FFR_QUEUE_SAVEFILES
+	/* save queue files even after successfull delivery on -d50.99 */
+	"_FFR_QUEUE_SAVEFILES",
+#endif /* _FFR_QUEUE_SAVEFILES */
 #if _FFR_QUEUE_SCHED_DBG
 	/* Debug output for the queue scheduler. */
 	"_FFR_QUEUE_SCHED_DBG",
diff -ur sendmail-8.13.8-orig/sendmail/envelope.c sendmail-8.13.8-qbexp/sendmail/envelope.c
--- sendmail-8.13.8-orig/sendmail/envelope.c	2006-03-31 13:53:50.000000000 -0500
+++ sendmail-8.13.8-qbexp/sendmail/envelope.c	2006-11-20 16:01:18.000000000 -0500
@@ -518,6 +518,31 @@
 				e->e_id, queueit);
 			printenvflags(e);
 		}
+
+#if _FFR_QUEUE_SAVEFILES_OPTION || _FFR_QUEUE_SAVEFILES
+		if (0 ||
+#if _FFR_QUEUE_SAVEFILES
+			(tTd(50, 99)) ||
+#endif /* _FFR_QUEUE_SAVEFILES */
+#if _FFR_QUEUE_SAVEFILES_OPTION
+			QueueSaveFiles ||
+#endif /* _FFR_QUEUE_SAVEFILES_OPTION */
+			0 )
+		{
+			char *reason = "leaving queue files";
+#if _FFR_QUEUE_SAVEFILES
+			if (tTd(50, 99)) 
+				reason = "leaving queue files for debugging";
+#endif /* _FFR_QUEUE_SAVEFILES */
+
+			/* dont queueup() */
+			e->e_flags |= EF_INQUEUE;
+			loseqfile(e, reason);
+			QueueMode = QM_LOST;
+			panic = true;
+		}
+		else
+#endif /* _FFR_QUEUE_SAVEFILES_OPTION || _FFR_QUEUE_SAVEFILES */
 		if (!panic)
 		{
 			if (e->e_dfp != NULL)
diff -ur sendmail-8.13.8-orig/sendmail/readcf.c sendmail-8.13.8-qbexp/sendmail/readcf.c
--- sendmail-8.13.8-orig/sendmail/readcf.c	2006-03-02 14:17:09.000000000 -0500
+++ sendmail-8.13.8-qbexp/sendmail/readcf.c	2006-11-20 16:55:04.000000000 -0500
@@ -2187,6 +2187,10 @@
 # define O_CRLPATH	0xd7
 	{ "CRLPath",		O_CRLPATH,	OI_NONE	},
 #endif /* _FFR_CRLPATH */
+#if _FFR_QUEUE_SAVEFILES_OPTION
+# define O_QUEUESAVEFILES 0xe7
+	{ "QueueSaveFiles",	O_QUEUESAVEFILES,	OI_NONE},
+#endif /* _FFR_QUEUE_SAVEFILES_OPTION */
 #if _FFR_HELONAME
 # define O_HELONAME 0xd8
 	{ "HeloName",   O_HELONAME,     OI_NONE },
@@ -3729,6 +3733,12 @@
 			FallbackSmartHost = newstr(val);
 		break;
 
+#if _FFR_QUEUE_SAVEFILES_OPTION
+	  case O_QUEUESAVEFILES:
+	  	QueueSaveFiles = true;
+		break;
+#endif  /* _FFR_QUEUE_SAVEFILES_OPTION */
+
 #if _FFR_HELONAME
 	  case O_HELONAME:
 		HeloName = newstr(val);
diff -ur sendmail-8.13.8-orig/sendmail/sendmail.h sendmail-8.13.8-qbexp/sendmail/sendmail.h
--- sendmail-8.13.8-orig/sendmail/sendmail.h	2006-05-22 21:32:07.000000000 -0400
+++ sendmail-8.13.8-qbexp/sendmail/sendmail.h	2006-11-20 18:56:25.000000000 -0500
@@ -2160,6 +2172,9 @@
 EXTERN bool	DontLockReadFiles;	/* don't read lock support files */
 EXTERN bool	DontPruneRoutes;	/* don't prune source routes */
 EXTERN bool	ForkQueueRuns;	/* fork for each job when running the queue */
+#if _FFR_QUEUE_SAVEFILES_OPTION
+EXTERN bool	QueueSaveFiles;	/* save qfiles even after successfull delivery */
+#endif /* _FFR_QUEUE_SAVEFILES_OPTION */
 EXTERN bool	FromFlag;	/* if set, "From" person is explicit */
 EXTERN bool	GrabTo;		/* if set, get recipients from msg */
 EXTERN bool	HasEightBits;	/* has at least one eight bit input byte */
