There's no reason to fork in this situation when this is something that can be done easily using the SMTP protocol. Forking introduces a WHOLE mess of unnecessary problems into a simple script that could potentially kill the server ie, infinite loops. Also, forking without knowing how to clean up your children is a bad idea. AND in the event the forking loop spins off into infinity and a successful connection is made to a mail server, think of the load that'll put on the mail server unnecessarily (it could potentially use up all available file descriptors and render the mail server unreachable until the connections close).
bottom line, that is WAY too complicated, but if you're still interested I wrote up a
node on forking that might be useful. I took time to read several different books and various web pages online for possible problems that I could encounter.
K.I.S.S.
-brad..