Net::SMTP - "Bad File Number" error ?

S

still just me

I'm using Net::SMTP to send mail from a perl program running on a web
server. Code is as follows:

my $relay="smtp.example.com";
my $smtp = Net::SMTP->new($relay);
die "Could not open connection: $!" if (! defined $smtp);

I'm familiar with the error you get when the SMTP server won't let you
in. It's usually "Could not open connection: Connection refused at
line... ". I run into that from time to time and the server people fix
what they messed up.

On this particular server (which used to work, but apparently they've
made changes), I'm now getting this error:

"Could not open connection:Bad file number at
/public_html/cgi-bin/submit.pl line 101"

What does "bad file number" mean?

Thanks,
 
S

still just me

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,
);

Interesting on the $! issue... it seems to throw the right error when
the connection is refused. As you noted, perhaps the other message is
not reliable.

What should the debug mode above do for me? I don't seem to get any
additional information when I incorporate it.
 
S

still just me

Interesting on the $! issue... it seems to throw the right error when
the connection is refused. As you noted, perhaps the other message is
not reliable.

What should the debug mode above do for me? I don't seem to get any
additional information when I incorporate it.

Whoops... ignore that question about the debug mode. Operator error
prevented me from seeing that it was dumping a message. I'll continue
studying the original issue.

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top