aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/toprocmail
diff options
context:
space:
mode:
authorRob Funk <rfunk@funknet.net>2004-06-08 03:59:01 +0000
committerRob Funk <rfunk@funknet.net>2004-06-08 03:59:01 +0000
commitd78b61e3efaea197a6e5b2b72bf2981a9ed69461 (patch)
tree1704e13ce5d767d59868a2d5e834cb2e988ed90f /contrib/toprocmail
parentd9e84e176fe538e110d9612f9832d69846e8d3e7 (diff)
downloadfetchmail-d78b61e3efaea197a6e5b2b72bf2981a9ed69461.tar.gz
fetchmail-d78b61e3efaea197a6e5b2b72bf2981a9ed69461.tar.bz2
fetchmail-d78b61e3efaea197a6e5b2b72bf2981a9ed69461.zip
Add files from ESR's dev directory that weren't under version control
svn path=/trunk/; revision=3881
Diffstat (limited to 'contrib/toprocmail')
-rw-r--r--contrib/toprocmail46
1 files changed, 46 insertions, 0 deletions
diff --git a/contrib/toprocmail b/contrib/toprocmail
new file mode 100644
index 00000000..159c0b38
--- /dev/null
+++ b/contrib/toprocmail
@@ -0,0 +1,46 @@
+#!/usr/bin/perl
+
+# fetchmail -> procmail pretti-fier proxy thingamajig
+# ver. 2000-04-01
+#
+# John Lim Eng Hooi <jleh@mail.com>
+#
+
+# Where's procmail located?
+$proc_path = '/usr/bin/procmail';
+
+# Define your ANSI color codes here, I've only bothered to define
+# those I use :)
+$ANSI_green = "\e[0;32m";
+$ANSI_b_white = "\e[1;37m";
+$ANSI_normal = "\e[0;39m";
+
+# Open up procmail
+open (PROCPIPE, "|$proc_path") || die "Can't open procmail pipe!";
+
+# Analyze the message line by line
+while (<STDIN>) {
+
+ # Suck up the lines we want, in this case I just want From: and Subject:
+ if (/^From:/) {
+ $from = $_;
+ }
+
+ if (/^Subject:/) {
+ $subj = $_;
+ }
+
+ # Stuff it out to the pipe too
+ print PROCPIPE;
+}
+
+# Print it out
+print "\n";
+print $ANSI_green, " ", $from;
+print $ANSI_b_white, " ", $subj, $ANSI_normal;
+
+# fetchmail's status is appended after this
+print " -->";
+
+# We're done
+close (PROCPIPE);