//jerrywalsh.org

coding, hacking, startups, computer security, technology and more

Stopping Qmail Autorespond From Replying to Root (e.g. CRON) Mails

Unfortunately, by default autorespond for qmail responds to far too much.. (mails from cron being an example)...

The following patches fixes this issue by telling autorespond to ignore emails from root or 'nobody':

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--- autorespond.c.old   Sat Feb  3 17:07:31 2007
+++ autorespond.c       Mon Feb  5 14:44:54 2007
@@ -598,8 +598,16 @@
                fprintf(stderr,"AUTORESPOND:  Stopping on mail from [%s].n",sender);
                _exit(0);
        }
-
-
+        if(strncasecmp(sender,"root@",5)==0) {
+               /*got one of my own messages...*/
+               fprintf(stderr,"AUTORESPOND : ignoring mail from ROOT (jbw patch)n");
+               _exit(0);                       /*hard error*/
+       }
+        if(strncasecmp(sender,"nobody@",7)==0 || strncasecmp(sender,"noreply@",8)==0) {
+               /*got one of my own messages...*/
+               fprintf(stderr,"AUTORESPOND : ignoring mail from NOREPLY/NOBODY (jbw patch)n");
+               _exit(0);                       /*hard error*/
+       }
        if ( inspect_headers("mailing-list", (char *)NULL ) != (char *)NULL )
        {

Enjoy