#!/opt/bin/perl # ######################################################################### # # # Program to send a folder of mails # # # ######################################################################### # # # Version 1.0 - Written 10.10.95 by Steffen Beyer # # # ######################################################################### # # # Copyright (C) 1995 by software design & management GmbH & Co. KG # # # ######################################################################### # # Some defaults: # $version = 'version 1.0'; # $self = $0; # if ($self =~ m!/([^/]+)$!) { $self = $1; } # $tempfile = "/tmp/$self.tmp.$$"; # $argc = @ARGV; # # Issue "about" info if no arguments are given: # if ($argc == 0) { print "$self $version\n"; print "Usage: $self \n"; exit; } # # Check number of arguments: # if ($argc != 1) { die "$self error: Wrong number of arguments ($argc instead of 1)!\n"; } # # Get and check the filename: # $filename = shift; # unless (-f $filename) { die "$self error: '$filename' is not a file!\n"; } # unless (-r $filename) { die "$self error: '$filename' is not readable!\n"; } # # Loop through input file: # unless (open(INPUTFILE, "<$filename")) { die "$self error: can't open '$filename': $!\n"; } # $send = 0; # while ($line = ) { if ($line =~ /^From \S+/) { if ($send) { &sendtemp; } $send = 1; unless (open(OUTPUTFILE, ">$tempfile")) { die "$self error: can't write '$tempfile': $!\n"; } } if ($send) { # if ($line =~ /^To: \S+/) # { # $line = "To: sdm.lists.asciiart@news.sdm.de\n"; # } print OUTPUTFILE $line; } } # close(INPUTFILE); # if ($send) { &sendtemp; } # # Done: # print "\nSent $sent_mails_counter mails.\n\n"; # exit; # sub sendtemp { # print OUTPUTFILE '-' x 78, "\n\n"; close(OUTPUTFILE); $send = 0; $sent_mails_counter++; # system("/bin/cat $tempfile"); system("/bin/cat $tempfile | /opt/bin/sendmail -t"); } # # __END__ #