Hmm, any chance of tackling the problem from the other direction? Have your perl script output a file if anything needs mailing, and have a separate (non-perl) process that scans for the output file and emails it if it exists.
Take a look at: Sending-Email-without-Client
<update>I just tried out using the Pickup directory - that seems to work fine.</update>
Tom Melly, email@example.com