jwood_70 has asked for the wisdom of the Perl Monks concerning the following question:
While I’m sure this is pretty poor compared to what you guys can do, it mostly works but it doesn’t have the subject in the emails.#!/usr/bin/perl -w $dir="/home/jwood/files"; opendir (JDE,$dir) or die "Cannot open $dir: $!"; while ( defined ($file = readdir JDE) ) { next if $file =~ /^\.\.?$/; my $filename = "$dir/$file"; print "$filename\n"; open CFILE, "$filename" or die "Cannot open $file: $!"; $line = <CFILE>; chomp($line); $address = $line; $line = <CFILE>; chomp($line); $subject = $line; print "mail -s \"$subject\" $address\n"; `/usr/bin/mail -s "$subject" $address < $filename`; close(CFILE); } closedir(JDE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File processing/email program
by GrandFather (Saint) on Oct 23, 2007 at 02:51 UTC | |
by jwood_70 (Initiate) on Oct 23, 2007 at 06:09 UTC | |
|
Re: File processing/email program
by toolic (Bishop) on Oct 23, 2007 at 02:55 UTC | |
|
Re: File processing/email program
by Krambambuli (Curate) on Oct 23, 2007 at 08:24 UTC |