in reply to Net::SMTP error
I am no expert on this, but I would assume that $smtp=Net::SMTP->new($out_server); is failing. A possible reason for this could be transient conditions. In my experience, dsl connections drop off more than you expect, and you could be trying when you have no connection to the internet?
Try and do some error checking, on the first line of your code, to see if it connects before continuing to authenticate, etc.
hope this helps
Regards,
Gerard