Back again apparently due to blindness. The code looks terrible, partly because I just modified a piece of code from a much larger script, to work standalone. Any remaining slop is just poor skill.
I'm having trouble spotting why this code doesn't mail any of what is supposed to get mailed, instead a message, apparently from a sendmail call lacking any content. And the print call to print to STDOUT doesn't print anything either. I tested my installation of sendmail by creating by hand, a file on disk with similar content as variable $emailmsg has below and a `useless use of cat' to create a similar feed to sendmail like this: cat emailmsg.txt|/usr/sbin/sendmail reader In that test, the mail is sent with the expected content. To the expected user. (I've included the content of emailmsg.txt below the script just for completeness.) So, I know sendmail isn't the problem.... ------- 8< snip ---------- 8< snip ---------- 8<snip ------- #!/usr/local/bin/perl use strict; use warnings; my $MAIL = 'TRUE'; my @body = ( "Gack danipkd kkn alkasdf-as a=--", "Line 2 of this nonsesense", "final line of this nonesense" ); my $subj = "Interesting"; if (@body) { if ($MAIL) { my $emailmsg = "To: read...@reader.local.lan Subject: NOTC|$subj\n @body\n.\n"; my $recip = $ENV{'LOGNAME'}; my $sendmail = '/usr/sbin/sendmail'; open(SENDMAIL,"|$sendmail $recip") or die "Can't open <$sendmail>: $!"; while (<SENDMAIL>) { print SENDMAIL "$emailmsg\n"; print "$emailmsg\n"; } close(SENDMAIL); } else { for (@body) { print "$_\n"; } } } ------- --------- ---=--- --------- -------- content of emailmsg.txt To: rea...@reader.local.lan Subject: NOTC|subj blabaiity blambkkk ------------------ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/