# a simple module which uses Net::SMTP to mail the contents # of a text file to a list of users. and with a # subject too! note minor spoofing. adjust to taste. package wmail; use Net::SMTP; sub mailfile{ my $smtpserver = 'server here plz'; my $file = shift; die "no file" unless $file; my $rcptsref = shift; die "no recipients" unless ref $rcptsref; my $subj = shift or "oops"; my @recipients = @{$rcptsref}; my $oldRs = $/; undef $/; open SOURCE, "$file" or die "can't open file $!"; my $totalcontents = ; close SOURCE; my $smtp = Net::SMTP; $smtp = Net::SMTP->new($smtpserver); $smtp->mail("informant"); $smtp->to(@recipients); $smtp->data(); my $subjectline = "Subject: " . $subj . "\n"; $smtp->datasend($subjectline); $smtp->datasend("\n"); $smtp->datasend($totalcontents); $smtp->dataend(); # print $smtp->domain, "\n"; $smtp->quit; } 1; #### use wmail; @recipients = ('your rcpts here'); wmail::mailfile("myfile", \@recipients, "mysubject");