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

Discussion in 'Python' started by Raaijmakers, Vincent \(GE Infrastructure\), Jun 29, 2004.

  1. run a "netstat -an' on the server and look for what ip address port 25 is open. Perhaps it is on 127.0.0.1 (localhost) instead of 192.168.1.105

    Vincent


    -----Original Message-----
    From: python-list-bounces+vincent.raaijmakers=
    [mailto:python-list-bounces+vincent.raaijmakers=]On
    Behalf Of Alex Hunsley
    Sent: Tuesday, June 29, 2004 10:27 AM
    To:
    Subject: sending of mail (smtp) - connection refused - but smtp server
    is running!


    I am using the smtp module to send emails via a local SMTP server on our network.
    I am failing with "connection refused" error, even though we definitely have an
    smtp server running on port 25!

    the code is like this:


    me = ''
    you = ''
    msg['Subject'] = '*** alert'
    msg['From'] = me
    msg['To'] = you

    s = smtplib.SMTP('192.168.1.105')
    s.connect()
    s.sendmail(me, [you], msg.as_string())
    s.close()

    print "Email sent."

    When I run this code, I get:


    Traceback (most recent call last):
    File "C:\Python23\check.py", line 58, in -toplevel-
    s.connect()
    File "C:\Python23\lib\smtplib.py", line 302, in connect
    raise socket.error, msg
    error: (10061, 'Connection refused')


    here's me verifying that SMTP server is indeed alive at port 25 on my local
    network:

    $ telnet 192.168.1.105 25
    Trying 192.168.1.105...
    Connected to 192.168.1.105.
    Escape character is '^]'.
    220 grain.companyname.com ESMTP Server FTGate
    helo
    250 grain.companyname.com


    any ideas what the problem could be? this usually happens when someone is not
    aware they have to run an SMTP server, but we do have one running, as can be
    seen above!

    thanks
    alex

    --
    http://mail.python.org/mailman/listinfo/python-list
     
    Raaijmakers, Vincent \(GE Infrastructure\), Jun 29, 2004
    #1
    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. matamoscas

    connection refused using smtp

    matamoscas, Sep 2, 2005, in forum: Java
    Replies:
    4
    Views:
    6,286
    matamoscas
    Sep 7, 2005
  2. Replies:
    3
    Views:
    1,092
    Roedy Green
    Jan 24, 2006
  3. Omega
    Replies:
    9
    Views:
    38,396
    Omega
    Feb 8, 2006
  4. Alex Hunsley
    Replies:
    4
    Views:
    3,487
    Tim Williams (gmail)
    Jun 29, 2004
  5. Replies:
    0
    Views:
    1,375
Loading...

Share This Page