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

Discussion in 'Perl Misc' started by still just me, Mar 8, 2008.

  1. 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,
     
    still just me, Mar 8, 2008
    #1
    1. Advertising

  2. On Sun, 09 Mar 2008 05:11:34 -0700, Joe Smith <> wrote:

    >still just me wrote:
    >> 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);

    >
    >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.
     
    still just me, Mar 10, 2008
    #2
    1. Advertising

  3. On Mon, 10 Mar 2008 19:57:16 GMT, still just me
    <> wrote:


    >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,
     
    still just me, Mar 10, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    1,095
    Roedy Green
    Jan 24, 2006
  2. Alex Hunsley
    Replies:
    4
    Views:
    3,503
    Tim Williams (gmail)
    Jun 29, 2004
  3. Raaijmakers, Vincent \(GE Infrastructure\)

    RE: sending of mail (smtp) - connection refused - but smtp serveris running!

    Raaijmakers, Vincent \(GE Infrastructure\), Jun 29, 2004, in forum: Python
    Replies:
    0
    Views:
    889
    Raaijmakers, Vincent \(GE Infrastructure\)
    Jun 29, 2004
  4. Copelandia Cyanescens

    smtplib.SMTP "no attributes SMTP"

    Copelandia Cyanescens, Jul 31, 2004, in forum: Python
    Replies:
    2
    Views:
    1,450
    Copelandia Cyanescens
    Jul 31, 2004
  5. tshad
    Replies:
    1
    Views:
    896
    bruce barker
    May 5, 2008
Loading...

Share This Page