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. Advertisements

  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. Advertisements

  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. Advertisements

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. Latha Rajeev

    SMTP Error

    Latha Rajeev, Jun 26, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    5,243
    Carlito
    Jun 7, 2007
  2. Replies:
    3
    Views:
    1,329
    Roedy Green
    Jan 24, 2006
  3. Alex Hunsley
    Replies:
    4
    Views:
    4,496
    Tim Williams (gmail)
    Jun 29, 2004
  4. Copelandia Cyanescens

    smtplib.SMTP "no attributes SMTP"

    Copelandia Cyanescens, Jul 31, 2004, in forum: Python
    Replies:
    2
    Views:
    2,141
    Copelandia Cyanescens
    Jul 31, 2004
  5. tshad
    Replies:
    1
    Views:
    1,081
    bruce barker
    May 5, 2008
  6. Daniel Berger

    net-smtp timeout error

    Daniel Berger, Jan 26, 2009, in forum: Ruby
    Replies:
    2
    Views:
    344
    Daniel Berger
    Jan 27, 2009
  7. Replies:
    6
    Views:
    1,432
    Sherm Pendley
    May 19, 2005
  8. - Bob -

    Net::SMTP module error

    - Bob -, Sep 28, 2006, in forum: Perl Misc
    Replies:
    5
    Views:
    331
    J. Gleixner
    Sep 28, 2006
Loading...