chimni has asked for the wisdom of the Perl Monks concerning the following question:
Hi fellow monks.
The following is a function i use to send mail.
It is quite simple.all i want to do is send an email.
No attachments etc. required.
Could anyone tell me how to make this sub routine more efficient.
Is there any reason for me to use any of the mail modules on CPAN to get just this basic functionality.
would this be better than calling
system("mailx -s ...");
or
`mailx -s ..`
from my script
sub sendmail { my($from,$recipients,$list,$sub,$msg,@timedown) = @_; open(MAIL, "|/usr/lib/sendmail -t"); my $old=select(MAIL) ; print<<"EOF" ; To: $recipients CC: $list From:$from Subject: $sub Body: @timedown $msg EOF close(MAIL); select($old); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Sub routine used to send a mail
by barrd (Canon) on Sep 30, 2003 at 09:59 UTC | |
Re: Sub routine used to send a mail
by jdtoronto (Prior) on Sep 30, 2003 at 12:37 UTC |