From: Joey Schulze Date: Sat, 7 Jun 2008 14:04:06 +0000 (+0000) Subject: Support internal mail ouput redirector X-Git-Url: https://git.infodrom.org/?p=infodrom.org%2Fservice.infodrom.org;a=commitdiff_plain;h=20ff409f8d75328d0bb7a66e82bc032fe409b3f6 Support internal mail ouput redirector --- diff --git a/src/InfoCon/buch/infocon b/src/InfoCon/buch/infocon index 49cd230..8147a3e 100755 --- a/src/InfoCon/buch/infocon +++ b/src/InfoCon/buch/infocon @@ -408,6 +408,7 @@ sub usage 'unpay' => undef, 'hide' => undef, 'unhide' => undef, + 'mailto' => undef, 'buchung-input' => undef, 'buchung-unpaid' => undef, 'buchung-hidden' => undef, @@ -421,6 +422,7 @@ my %options = ( 'unhide=s' => \$data{unhide}, 'year=i' => \$opt_year, 'direction=s' => \$opt_direction, + 'mailto:s' => \$data{mailto}, 'all' => \$opt_all, 'verbose' => \$opt_verbose, 'help' => \&usage, @@ -431,6 +433,7 @@ my %options = ( 'list-categories|lc' => \$data{'list-categories'}, ); +my $cmdln = 'infocon ' . join (' ', @ARGV); GetOptions(%options); if ($opt_year != 0 && $opt_year < 2002) { @@ -441,6 +444,19 @@ if (defined $opt_direction) { usage unless $opt_direction =~ /^(in|out)$/i; } +if (defined $data{mailto}) { + if (open(STDOUT, "| /usr/sbin/sendmail -t")) { + print "From: Joey Schulze \n"; + printf "To: %s\n", length($data{mailto})?$data{mailto}:'Joey Schulze '; + printf "Subject: %s\n", $cmdln; + print "MIME-Version: 1.0\n"; + print "Content-type: text/plain; charset=iso-8859-1\n"; + print "Content-Disposition: inline\n"; + print "Content-Transfer-Encoding: 8bit\n"; + print "\n"; + } +} + if (defined $data{category}) { if (length($data{category})) { sales_list("category = '".$data{category}."'");