in reply to Re^4: Email Question
in thread Email Question
But this might probably be more a Unix/Linux question than a Perl question. Not all mail utilities have exactly the same syntax, may be your should check yours.
A possible alternative might be something along these lines (I haven't tested exactly that, but only something similar):
Having said that, it might well be better to use a mail module, such as Mail::Send, Mail::Sendmail or some other (there are many, and I really can't advise one against any other).my $subject = "Mail subject\n"; my $from = 'me@my_company.com\n'; my $cc = "whoever\@my_company.com\n"; open my $MAIL, "|/usr/sbin/sendmail -t" or die "... $!";; # Mail Header print $MAIL "To: addressee\@my_company.com\n"; print $MAIL "Cc: $cc"; print $MAIL "From: $from"; print $MAIL "Subject: $subject\n\n"; # Mail Body print $MAIL "\nThe accompanying message to be sent.\n\n"; my $stat_file = "$result_path/STAT.TXT"; open my $COUNT, "<", $stat_file or die "can't open $stat_file $!"; print $MAIL <$COUNT>; close $COUNT; print $MAIL "\n\n\n"; print $MAIL "Regards, \n"; print $MAIL "sender's signature, \n"; close $MAIL;
|
|---|