Trying to send email attachment on HP UX using mailx through Perl isnt working

Posted by CheeseConQueso on Stack Overflow See other posts from Stack Overflow or by CheeseConQueso
Published on 2010-03-25T20:23:21Z Indexed on 2010/03/25 21:03 UTC
Read the original article Hit count: 500

Filed under:
|
|
|
|

Here's my code that is not working:

print "To: ";  my $to=<>;  chomp $to;
print "From: ";  my $from=<>;  chomp $from;
print "Attach: "; my $attach=<>; chomp $attach;
print "Subject: "; my $subject=<>; chomp $subject;
print "Message: "; my $message=<>; chomp $message;

my $mail_fh = \*MAIL;
open $mail_fh, "uuencode $attach $attach |mailx -m -s \"$subject\" -r $from $to";
print $mail_fh $message;
close($mail_fh);

the mailx command works fine off the command line, but not in this perl script context.

any idea what I'm missing?


i suspect that this line's format/syntax:

open $mail_fh, "uuencode $attach $attach |mailx -m -s \"$subject\" -r $from $to";

is the culprit

© Stack Overflow or respective owner

Related posts about hpux

Related posts about mailx