I think $! is not meaningful here. See "perldoc perlvar"
for the definition of $!.
> What does "bad file number" mean?
It means, that a file handle was used that was not open.
Frank
--
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel
The docs for Net::SMTP does not say that it sets $!, so don't rely on that.
Have you tried turning on debugging?
$smtp = Net::SMTP->new(
Host => 'smtp.example.com',
Hello => 'my.mail.domain'
Timeout => 30,
Debug => 1,
);