Lz wrote at Tue, 28 May 2002 17:57:57 +0200:

> Hi guys,
> 
> open TMP, ">/home/dev/perl/mail_queue/$filename" or die "Can't create file: $!";
> 
> I read an incoming file, modify it and save it in the file, as seen above.
> 
> Later on, I'd like to send the above generated file:
> 
> I try the following, but it doesn't work.
> open MSG, "|mailx -s \"test\" $mailAddress < $TMP"; close MSG;
> 
> Any ideas how to make it work?

The problem is that TMP is only a filehandle.
For that what you want you need the filename.
However, $TMP is never defined (it's different to TMP), 
so I'm surprised, that you didn't got a warning.
Did you use

use strict;
use warnings; 

??

Also, you opened a pipe to write in,
where you wanted a system call:

You should try instead

my $fname = "/home/dev/perl/mail_queue/$filename";
open TMP, ">$fname" or die "...";
...
system("mailx","-s","test","$mailAddress","<$fname") == 0 or die " ...";

But the best solution is still to use an existing module
like Ricardo already mentioned.
If you don't like MIME::Lite, you can use
Mail::Mailer, Mail::Sendmail, Mail::Send, or what you want.

Best Wishes,
Janek


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to