Well that's what I was hoping I could do but thinking about it Sendmail needs to know when to send the email and I think close MAIL; is the line that tells Sendmail to send and so it has to go inside the loop, as does open... to re-open Sendmail.
Mglaspie:
Thanks. I've used Net::SMTP before and it is a possible option but the script may not be used by someone with SMTP capabilities so I need Sendmail as another option.
The script I'm writing is one that allows people to sign up and email a product/website advert to the other members - there are differenct groups who can accept/reject emails from other groups.
I'm actually quite pleased at the moment as I am almost finished writing 3 modules to go with it. Parser.pm, Mailer.pm and Database.pm (It uses MySQL).
Database.pm I'm particularly proud of as it makes SQL queries so easy.
To do a SELECT you'd just do....
Code:
$db->select( TABLE => 'Members',
COLS => ['Username', 'Password'],
);
The resulting query would be:
SELECT Username,Password FROM Members
That's just a simple example.