aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/toprocmail
blob: 159c0b38e39bbdc1b39b23a53bd2511522126379 (plain)
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inse
#!/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);