loan tran <[EMAIL PROTECTED]> writes:
> Howdy,
>
> 1. Can a variable store a text file with 40000+ bytes
> in size?
I am under the impression that a scalar can be as big as you need. I
*suspect* that the problem lies in limitations on the size of an <<EOF
document - but someone more knowledgable will have to answer that
part.
> 2. How can I cc or send a message to 2 persons at the
> same time using sendmail?
A comma-seperated list, or Cc: - -
To: addr\@host.com, addr2\@host2.org
Cc: rdda\@toast.com
> 3. Could someone please suggest a better way than mine
> to send a content of a text file using sendmail.
I believe the 'canonical' way is:
open(INPUT, '$reportdir/$eachowner.txt') or die "Danger! $!";
> Below is part of my script. The problem is if my
> message is big ($eachowner.txt is over 40000 bytes)
> a receiver does not get the whole message.
#...don't use this...
> $mail_message = `cat $reportdir/$eachowner.txt`;
> &sendownermail($eachowner,$mail_message);
#...back to your code...
> sub sendownermail{
> my $to = $_[0];
> my $mail_message = $_[1];
> open(SENDMAIL, "|/usr/lib/sendmail -oi -t") or die
> "Cannot fork for send mail: $! \n";
> print SENDMAIL<<"EOF";
> From: [EMAIL PROTECTED]
> To: $to\@yourhost.com
> Subject: db Report
>
> EOF
#...get rid of this part... -V
>
> $mail_message
>
> EOF
#...and use this instead... -V
while (<INPUT>) {
print SENDMAIL $_;
}
close(INPUT);
> close(SENDMAIL) or warn "sendmail dinnot close
> nicely";
> }# end sendownermail
This way, no more than one line of <INPUT> is in memory at one time.
-RN
--
Robin Norwood
Red Hat, Inc.
"The Sage does nothing, yet nothing remains undone."
-Lao Tzu, Te Tao Ching
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]