Dalin has asked for the wisdom of the Perl Monks concerning the following question:
I run it, and everything seems to go fine, but I get no mail. My syslog also shows no record of a mail being submitted. Any help anyone could provide would be greatly appreciated. I'm also looking for some info on my coding... any suggestions on making it better? Thanks in advance, Bradley#!/usr/gnu/bin/perl -w # # use strict; no strict "refs"; use Mail::Sender; my $f2dir = "/home/bradley/scripts/prog/names"; my @names = <$f2dir/*.f2mail>; my $file; foreach $file (@names) { if ( (! -d $file) && ($file =~ /\b\.f2mail/) ) { parse_mail($file); print "."; }else{ print "Error with $file, $!"; } } ###################################################################### +########## # Begin Subroutines # # parse_mail parses the parameter file (*.f2mail) and submits the resu +lts to # Mail::Sender for smtp ###################################################################### +########## sub parse_mail { my $mail = "@_"; open (MAIL,$mail) || die "Cannot open $mail, $!"; my @mailf = <MAIL>; chomp (@mailf); close (MAIL) || die "Cannot close $mail, $!"; sender_mail(@mailf); } ###################################################################### +########## # # sender_mail calls the Mail:Sender module and prepares for smtp ###################################################################### +########## sub sender_mail { my @mailf = @_; open (BODY,$mailf[3]) || die "Cannot open $mailf[3], $!"; my @body = <BODY>; close (BODY) || die "Cannot close $mailf[3], $!"; rename($mailf[4],"$mailf[4]\.txt") || die "Cannot rename $mail +f[4], $!"; my $sender; ($sender = new Mail::Sender ({ from => $mailf[2], smtp => 'localhost'})) || die "Send +er error: $sender, $Mail::Sender::Error!\n"; ($sender->MailFile( {to => $mailf[0], subject => $mailf[1], msg => "@body" +, file => $mailf[4]})) || die "Sender error, $sender, $Mail::Sender::Error!"; }
Where ever there is confusion to be had... I'll be there.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Mail::Sender question... again
by ryddler (Monk) on Jun 29, 2001 at 07:40 UTC | |
by Dalin (Sexton) on Jun 29, 2001 at 16:14 UTC |