in reply to How to send email

What file are you trying to send? The file at $rptname? Because with your open line, you just wiped out the contents of $rptname. Whatever was in there before is now gone, so there's nothing to feed into mailx.

Do you need to create a file? You could do all of this in memory. Just create a scalar that contains your mail message. Then send it using one of the Mail:: modules. Mail::Mailer may do what you want:

use Mail::Mailer; my $mailer = new Mail::Mailer 'sendmail'; $mailer->open( { To => 'foo@bar.com', Subject => 'Report' } ); ## Create report in scalar $report... then write it. print $mailer $report; $mailer->close;
You can also use SMTP or mail to send your mail.

Replies are listed 'Best First'.
RE: Re: How to send email
by cleen (Pilgrim) on Jul 06, 2000 at 04:09 UTC
    Just as a quick addition to btrott's comment on using smtp, as an example you could glance at this quick little post I made a few days back here I think it could fit right into the program easily..