--- spamass-milt/spamass-milter.cpp	2004-09-24 06:42:16.000000000 +0200
+++ spamass-milter-0.2.0+cvs20041018/spamass-milter.cpp	2004-10-18 16:00:10.000000000 +0200
@@ -170,6 +170,10 @@
 bool flag_full_email = false;		/* pass full email address to spamc */
 bool flag_expand = false;	/* alias/virtusertable expansion */
 
+// ADI: custom reject message
+bool flag_customreject = false;
+char *rejectmessage;
+
 #if defined(__FreeBSD__) /* popen bug - see PR bin/50770 */
 static pthread_mutex_t popen_mutex = PTHREAD_MUTEX_INITIALIZER;
 #endif
@@ -180,7 +184,7 @@
 main(int argc, char* argv[])
 {
    int c, err = 0;
-   const char *args = "fd:mMp:P:r:u:D:i:b:B:e:x";
+   const char *args = "fd:mMp:P:r:u:D:i:b:B:e:cx";
    char *sock = NULL;
    bool dofork = false;
    char *pidfilename = NULL;
@@ -259,6 +263,11 @@
 			case 'x':
 				flag_expand = true;
 				break;
+			case 'c':
+				//ADI: custom error message
+				flag_customreject = true;
+				rejectmessage = strdup(getenv("REJECT_MESSAGE"));
+				break;
 			case '?':
 				err = 1;
 				break;
@@ -301,6 +310,7 @@
       cout << "   -u defaultuser: pass the recipient's username to spamc.\n"
               "          Uses 'defaultuser' if there are multiple recipients." << endl;
       cout << "   -x: pass email address through alias and virtusertable expansion." << endl;
+      cout << "   -c: custom reject message." << endl;
       cout << "   -- spamc args: pass the remaining flags to spamc." << endl;
               
       exit(EX_USAGE);
@@ -450,10 +460,17 @@
 	}
 	if (do_reject)
 	{
-		debug(D_MISC, "Rejecting");
-		smfi_setreply(ctx, "550", "5.7.1", "Blocked by SpamAssassin");
-
-
+		//ADI: do custom reject
+		if (flag_customreject)
+		{
+			debug(D_MISC, "Rejecting with custom message");
+			smfi_setreply(ctx, "550", "5.7.1", rejectmessage);
+		}
+		else
+		{
+			debug(D_MISC, "Rejecting");
+			smfi_setreply(ctx, "550", "5.7.1", "Blocked by SpamAssassin");
+		}
 		if (flag_bucket)
 		{
 			/* If we also want a copy of the spam, shell out to sendmail and
