Added an option to set the date range for which autoreplies are sent
authorJamie Cameron <jcameron@webmin.com>
Sat, 14 Jul 2007 18:52:55 +0000 (18:52 +0000)
committerJamie Cameron <jcameron@webmin.com>
Sat, 14 Jul 2007 18:52:55 +0000 (18:52 +0000)
sendmail/autoreply.pl

index 37defdb..839f745 100755 (executable)
@@ -60,6 +60,13 @@ if ($header{'from'} =~ /postmaster|mailer-daemon/i) {
        exit 0;
        }
 
+# Check if we are within the requested time range
+if ($header{'Autoreply-Start'} && time() < $header{'Autoreply-Start'} ||
+    $header{'Autoreply-End'} && time() > $header{'Autoreply-End'}) {
+       # Nope .. so do nothing
+       exit 0;
+       }
+
 # work out the correct to address
 @to = ( &split_addresses($header{'to'}),
        &split_addresses($header{'cc'}),