in reply to Sending looped emails

Each of those header lines (and the last dot) needs to be on a different line IIRC. So:
open( MAIL, "| $sendmail -t" ); print MAIL "To: $_\n"; print MAIL "From: $adminmail\n"; print MAIL "Subject: $subject\n\n"; print MAIL "$message\n"; print MAIL "."; close(MAIL); print "Email was sent to: $_!<br>";
If that doesn't work, then I suggest you read up on the docs and try to send a message manually the same way to see if that works.

Update Also, shouldn't $message | $subject eq "" be something like $message eq "" || $subject eq ""? Or more cleanly, !$message || !$subject.

Replies are listed 'Best First'.
Re: Re: Sending looped emails
by sulfericacid (Deacon) on Apr 07, 2003 at 00:40 UTC
    Ok, that was the problem. I did know you had to \n each line but oddly enough I didn't realise I forgot to do that. Everyone can downvote me for making a mistake but please don't waste time by replying to this since I already have the problem solved now. As for your update, let me check to see if mine actually works.. Three tests and my original code seems to do the trick (if either or is left out, the email won't send). If your way is definately better than mine, I'll switch over but as it looks right now there's nothing wrong with it.

    Thanks for your help Mad Hatter!

    "Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

    sulfericacid

      Hmmm. I used this code to test your way:
      $foo = ""; $bar = "moo"; print "true\n" if $foo | $bar eq "";
      That doesn't print true, like it should if your way worked. That's what let me to believe that your way wouldn't work. Of course, I'm probably not understanding something...

      Anyway, glad to help.