layouts/_default/single.html

Pine and Outgoing Filters

Article replaced 9/5/05

One mailing list I’m on requires that all posts have a signature block; it even requires additional information not found in my normal signature. The problem is, I rarely remember to bother playing that game, especially after a big bulk delete of quoted material. So, my options were either one hell of a neurosurgeon to fix my memory issues, or to find a way to force outgoing mail, but only for that list, to forcefully have a specific signature block.

I use “pine” on unix, which I’m sure will elicit a crowd of laughter. Okay, done? So, pine does have the ability to send outbound messages through a filter. Normally, this is an optional step, and allows people to do things like set up GPG signatures on outbound mail. I’m using that hook to handle signatures.

 #! /usr/local/bin/perl5
 
 # PINE .pinerc:
 #sending-filters=/home/jfesler/bin/sending-filter _TMPFILE_ _RECIPIENTS_
 
 my $tmpfile = shift @ARGV;
 die "Missing tmpfile"  unless (-f $tmpfile);
 open(MESSAGE,">>$tmpfile");
 
 if (scalar grep(/\@st1100.com/,@ARGV)) {
   addsig("/home/jfesler/.signature.stoc");
 }
 
 sub addsig {
  my($sig) = @_;
  unless(open(SIG,"<$sig")) {
    print STDERR "Missing $sig : $!";
    sleep 3;
    return;
  }
  print MESSAGE "-- \n";
  while(<SIG>) {
    print MESSAGE;
  }
  close SIG;
 }

These do a few things; 1: they set up logging. 2: they match one specific destination, and if found, append a signature file (in this case, .signature.stoc) at the end. And, lastly, it outputs *only* the message body (not the header) to “stdout”. Pine will do unhappy things if you output a header, so don’t do that.

Recent Posts