Robin et all,
I've tried what you recommended but still face the
same problem, some of my receivers do not receive full
message. I cannot figure out why.
Here is new code. (note that @ownerlist has 25
elements)
#
foreach $eachowner(@ownerlist){
$sql_ownwhat = qq(select sybaseServer, dbName
from DatabaseOwner where email_test = "$eachowner");
&sybase_connect("FCCDEV01W",'aigdb',"$sql_ownwhat");
#combine all files that belong to each owner to one
file.
while($ownwhatdata = $sth->fetchrow_hashref){
`cat
$reportdir/$ownwhatdata->{sybaseServer}..$ownwhatdata->{dbName}.users
>> $reportdir/$eachowner.mail`;
}#end while
$sth->finish;
#now start send mail
open (MAILFILE,"$reportdir/$eachowner.mail") or die
"Can not open ! $!";
open(SENDMAIL, "|/usr/lib/sendmail -oi -t") or die
"Cannot fork for send mail: $! \n";
print SENDMAIL<<"EOF";
From: ltran\@my
To: you\@yourhost
cc: myboss\@my
Subject: Report
Howdy,
I'm sending you bla bla....
EOF
while (<MAILFILE>){
print SENDMAIL $_;
}
close MAILFILE;
close(SENDMAIL) or warn "sendmail dinnot close
nicely";
}#end foreach
--- Robin Norwood <[EMAIL PROTECTED]> wrote:
> 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]
>
__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]