#!/usr/bin/perl # Martin Domig - Wed Aug 7 17:15:04 CEST 2002 # wandelt plaintext mail in html um, # output wird an /home/fax/bin/html2ps uebergeben use HTML::Entities; open(STDIN, $ARGV[0]); open(STDOUT, "| /home/fax/bin/html2ps"); print("
\n\n"); $inheaders = 0; $special = 0; my %headers; $headers{"From"} = "Von"; $headers{"To"} = "An"; $headers{"Date"} = "Datum"; $headers{"Cc"} = "Kopie an"; $headers{"Subject"} = "Betreff"; while(\n"); close(STDOUT);) { $special = 0; if(/--- APPENDED HEADERS END/) { $inheaders = 0; $special = 1; print("\n\n"); } if((/--- APPENDED HEADERS/) && ($special == 0)) { $inheaders = 1; $special = 1; } if($special == 0) { if($inheaders == 1) { ($header, $text)=(/^([^:]+): (.*)/); $text = HTML::Entities::encode($text); $text =~ s/\¤\;/\&euro\;/g; $header = $headers{$header}; print("$header: $text\n"); } else { # Lange zeilen umbrechen $_ =~ s/(.{75}\s+)/$1\n/g; # Wenn nach 90 zeichen kein \n kommt eins einfuegen $_ =~ s/([^\n]{90})/$1\n/g; my $escaped = HTML::Entities::encode($_); $escaped =~ s/\¤\;/\&euro\;/g; print $escaped; } } } print("