Re: email questions

Discussion in 'Python' started by Scott Frankel, Feb 8, 2006.

  1. Seems I'm still having issues with syntax.

    From what I can tell from my mail client, my outgoing mail server
    name is either

    mail.<ispname>.net
    or
    mail.<ispname>.net:<myUsername>@<myDomain>.com

    The former yields the same socket error on connect() that I reported
    earlier. The latter yields a "nonnumeric port" error upon
    instantiation. Instantiating with the port number,

    s = smtplib.SMTP("mail.<ispname>.net:<myUsername>@<myDomain>.com",
    portNum)

    yields the following error:

    socket.gaierror: (7, 'No address associated with nodename')


    Suggestions?

    Thanks again
    Scott




    On Feb 8, 2006, at 9:47 AM, Carsten Haese wrote:

    > On Wed, 2006-02-08 at 12:34, Scott Frankel wrote:
    >> I'm looking for a way to send a simple, plain text email message
    >> using Python. My initial attempts are failing with the following
    >> error:
    >>
    >> socket.error: (61, 'Connection refused')
    >>
    >> Does this imply that I do not have the machine's smtp server
    >> running?

    >
    > Yes.
    >
    >> (I don't; and I'd like to avoid setting it up.)

    >
    > You don't have to set up an smtp server to use smtplib. You should be
    > able to use your ISP's outgoing mail server, as in
    >
    > s = smtplib.SMTP("<ISP's mail server name goes here>")
    >
    > HTH,
    >
    > Carsten.
    >
    >
    > --
    > http://mail.python.org/mailman/listinfo/python-list
     
    Scott Frankel, Feb 8, 2006
    #1
    1. Advertising

  2. Scott Frankel wrote:

    >
    > Seems I'm still having issues with syntax.
    >
    > From what I can tell from my mail client, my outgoing mail server
    > name is either
    >
    > mail.<ispname>.net
    > or
    > mail.<ispname>.net:<myUsername>@<myDomain>.com
    >
    > The former yields the same socket error on connect() that I reported
    > earlier. The latter yields a "nonnumeric port" error upon
    > instantiation. Instantiating with the port number,


    The latter isn't a hostname, it's a hostname (mail.<ispname>.net) padded
    with user information for SMTP-Auth, which shouldn't be written in this
    format anyway.

    Probably your Provider only supports SMTPs or the like (which doesn't use
    the default port 25, check for that. Otherwise: if connections are still
    refused, does your provider really want you to use this mailserver? Or are
    they providing some other relay? I know most ISPs I know and work with use
    smtp.<ispname> for their outgoing client-relay.

    --- Heiko.
     
    Heiko Wundram, Feb 8, 2006
    #2
    1. Advertising

  3. On Wed, 8 Feb 2006 10:49:27 -0800, Scott Frankel <>
    declaimed the following in comp.lang.python:


    >
    > mail.<ispname>.net


    Not sure why you feel you need to hide it -- I'm presuming it is the
    same ISP in your email address...

    However, I'm currently finding a dead access to it...

    C:\Documents and Settings\Dennis Lee Bieber>tracert smtp.pacbell.net
    Unable to resolve target system name smtp.pacbell.net.

    C:\Documents and Settings\Dennis Lee Bieber>tracert mail.pacbell.net

    Tracing route to mail.pacbell.net [207.115.57.20]
    over a maximum of 30 hops:

    1 1 ms <1 ms <1 ms 192.168.1.1
    2 17 ms 13 ms 14 ms user-11fa401.dsl.mindspring.com
    [66.245.16.1]
    3 13 ms 13 ms 15 ms cor02-vl-10.ca-sanfranc0.ne.earthlink.net
    [209.165.103.65]
    4 16 ms 13 ms 16 ms
    bor01-ge-6-1.ca-sanfranc0.ne.earthlink.net [209.165.103.17]
    5 22 ms 22 ms 22 ms
    bor02-so-3-1.ca-pasadena0.ne.earthlink.net [209.165.109.154]
    6 23 ms 27 ms 31 ms
    bor01-ge-1-1-0.ca-losangel4.ne.earthlink.net [209.165.107.182]
    7 28 ms 21 ms 22 ms ex1-g8-1s1.eqlaca.sbcglobal.net
    [206.223.123.79]
    8 24 ms 22 ms 23 ms ex2-p3-0.eqlaca.sbcglobal.net
    [151.164.191.226]
    9 25 ms 24 ms 24 ms bb1-p6-0.crrvca.sbcglobal.net
    [151.164.41.34]
    10 23 ms 24 ms 27 ms core2-p4-0.crrvca.sbcglobal.net
    [151.164.41.1]
    11 58 ms 61 ms 59 ms core2-p3-0.crhstx.sbcglobal.net
    [151.164.241.125]
    12 88 ms 89 ms 81 ms core1-p9-0.cratga.sbcglobal.net
    [151.164.191.192]
    13 83 ms 82 ms 84 ms core2-p1-0.cratga.sbcglobal.net
    [151.164.241.82]
    14 82 ms 82 ms 83 ms core2-p6-0.crhnva.sbcglobal.net
    [151.164.41.206]
    15 88 ms 89 ms 90 ms core2-p3-0.crnyny.sbcglobal.net
    [151.164.188.197]
    16 91 ms 88 ms 89 ms bb2-p3-0.nycmny.sbcglobal.net
    [151.164.240.221]
    17 88 ms 90 ms 87 ms ded2-g8-3-0.nycmny.sbcglobal.net
    [151.164.41.181]
    18 93 ms 90 ms 98 ms 66.10.112.6
    19 * * * Request timed out.
    20 * * * Request timed out.
    21 * * * Request timed out.
    22 * * * Request timed out.
    23 * * * Request timed out.
    24 * ^C
    C:\Documents and Settings\Dennis Lee Bieber>


    Whereas the news server is active...

    C:\Documents and Settings\Dennis Lee Bieber>tracert news.pacbell.net

    Tracing route to news.pacbell.net [206.13.28.26]
    over a maximum of 30 hops:

    1 <1 ms 2 ms <1 ms 192.168.1.1
    2 14 ms 12 ms 12 ms user-11fa401.dsl.mindspring.com
    [66.245.16.1]
    3 16 ms 15 ms 13 ms cor01-vl-10.ca-sanfranc0.ne.earthlink.net
    [209.165.103.33]
    4 19 ms 18 ms 16 ms
    bor01-ge-1-2.ca-sanfranc0.ne.earthlink.net [209.165.103.1]
    5 21 ms 22 ms 22 ms
    bor02-so-3-1.ca-pasadena0.ne.earthlink.net [209.165.109.154]
    6 25 ms 32 ms 28 ms
    bor01-ge-1-1-0.ca-losangel4.ne.earthlink.net [209.165.107.182]
    7 24 ms 21 ms 22 ms ex1-g8-1s1.eqlaca.sbcglobal.net
    [206.223.123.79]
    8 23 ms 22 ms 22 ms bb1-p2-0.cranca.sbcglobal.net
    [151.164.40.227]
    9 28 ms 22 ms 24 ms core1-p9-0.cranca.sbcglobal.net
    [151.164.40.93]
    10 42 ms 42 ms 45 ms core2-p3-0.crscca.sbcglobal.net
    [151.164.242.185]
    11 41 ms 41 ms 44 ms core1-p1-0.crscca.sbcglobal.net
    [151.164.241.233]
    12 43 ms 41 ms 43 ms core2-p2-0.crsfca.sbcglobal.net
    [151.164.42.47]
    13 44 ms 49 ms 43 ms core1-p8-0.crsfca.sbcglobal.net
    [151.164.242.73]
    14 43 ms 41 ms 42 ms bb1-p12-0.snfcca.sbcglobal.net
    [151.164.243.126]
    15 46 ms 41 ms 42 ms bb2-g8-3-0.snfcca.sbcglobal.net
    [151.164.43.49]
    16 45 ms 42 ms 41 ms nntp1-sf.pbi.net [206.13.28.26]

    Trace complete.

    C:\Documents and Settings\Dennis Lee Bieber>
    --
    > ============================================================== <
    > | Wulfraed Dennis Lee Bieber KD6MOG <
    > | Bestiaria Support Staff <
    > ============================================================== <
    > Home Page: <http://www.dm.net/~wulfraed/> <
    > Overflow Page: <http://wlfraed.home.netcom.com/> <
     
    Dennis Lee Bieber, Feb 9, 2006
    #3
  4. On Thu, 2006-02-09 at 00:50, Dennis Lee Bieber wrote:
    > On Wed, 8 Feb 2006 10:49:27 -0800, Scott Frankel <>
    > declaimed the following in comp.lang.python:
    >
    >
    > >
    > > mail.<ispname>.net

    >
    > Not sure why you feel you need to hide it -- I'm presuming it is the
    > same ISP in your email address...
    >
    > However, I'm currently finding a dead access to it...
    >
    > C:\Documents and Settings\Dennis Lee Bieber>tracert smtp.pacbell.net
    > Unable to resolve target system name smtp.pacbell.net.
    >
    > C:\Documents and Settings\Dennis Lee Bieber>tracert mail.pacbell.net
    >
    > Tracing route to mail.pacbell.net [207.115.57.20]
    > over a maximum of 30 hops:
    >
    > 1 1 ms <1 ms <1 ms 192.168.1.1
    > 2 17 ms 13 ms 14 ms user-11fa401.dsl.mindspring.com
    > [66.245.16.1]
    > 3 13 ms 13 ms 15 ms cor02-vl-10.ca-sanfranc0.ne.earthlink.net
    > [209.165.103.65]
    > 4 16 ms 13 ms 16 ms
    > bor01-ge-6-1.ca-sanfranc0.ne.earthlink.net [209.165.103.17]
    > 5 22 ms 22 ms 22 ms
    > bor02-so-3-1.ca-pasadena0.ne.earthlink.net [209.165.109.154]
    > 6 23 ms 27 ms 31 ms
    > bor01-ge-1-1-0.ca-losangel4.ne.earthlink.net [209.165.107.182]
    > 7 28 ms 21 ms 22 ms ex1-g8-1s1.eqlaca.sbcglobal.net
    > [206.223.123.79]
    > 8 24 ms 22 ms 23 ms ex2-p3-0.eqlaca.sbcglobal.net
    > [151.164.191.226]
    > 9 25 ms 24 ms 24 ms bb1-p6-0.crrvca.sbcglobal.net
    > [151.164.41.34]
    > 10 23 ms 24 ms 27 ms core2-p4-0.crrvca.sbcglobal.net
    > [151.164.41.1]
    > 11 58 ms 61 ms 59 ms core2-p3-0.crhstx.sbcglobal.net
    > [151.164.241.125]
    > 12 88 ms 89 ms 81 ms core1-p9-0.cratga.sbcglobal.net
    > [151.164.191.192]
    > 13 83 ms 82 ms 84 ms core2-p1-0.cratga.sbcglobal.net
    > [151.164.241.82]
    > 14 82 ms 82 ms 83 ms core2-p6-0.crhnva.sbcglobal.net
    > [151.164.41.206]
    > 15 88 ms 89 ms 90 ms core2-p3-0.crnyny.sbcglobal.net
    > [151.164.188.197]
    > 16 91 ms 88 ms 89 ms bb2-p3-0.nycmny.sbcglobal.net
    > [151.164.240.221]
    > 17 88 ms 90 ms 87 ms ded2-g8-3-0.nycmny.sbcglobal.net
    > [151.164.41.181]
    > 18 93 ms 90 ms 98 ms 66.10.112.6
    > 19 * * * Request timed out.
    > 20 * * * Request timed out.
    > 21 * * * Request timed out.
    > 22 * * * Request timed out.
    > 23 * * * Request timed out.


    This does not necessarily mean that the server is down. Routers can
    filter traceroute and ping. Telnet to mail.pacbell.net on port 25 works
    just fine. If the server had been down, the OP would not have gotten
    "connection refused", he would have gotten a connection timeout.

    The OP's problem is most likely that he's doing this:

    s = smtplib.SMTP("mail.pacbell.net") # This already connects s
    s.connect() # This reconnects s to localhost and is refused

    when he should do this:

    s = smtplib.SMTP() # make an unconnected SMTP instance
    s.connect("mail.pacbell.net") # and connect it.

    or simply this:

    s = smtplib.SMTP("mail.pacbell.net")

    -Carsten
     
    Carsten Haese, Feb 9, 2006
    #4
  5. On Thu, 09 Feb 2006 08:36:38 -0500, Carsten Haese <>
    declaimed the following in comp.lang.python:

    >
    > This does not necessarily mean that the server is down. Routers can
    > filter traceroute and ping. Telnet to mail.pacbell.net on port 25 works
    > just fine. If the server had been down, the OP would not have gotten
    > "connection refused", he would have gotten a connection timeout.
    >

    Agreed -- though it does seem inconsistent that they'd block it on
    the mail server, but not on the news server <G>

    And since a later post stated the problem was solved, if was
    superfluous -- I'd likely have canceled my post but I was having all
    sorts of problems with the earthlink servers last night (things like
    "too many connections", news.west was hanging with a "retrieving 1
    header for c.l.p", news.east was slow... And this AM news.east is
    feeding me 3400 bodies for comp.lang.ada!)
    --
    > ============================================================== <
    > | Wulfraed Dennis Lee Bieber KD6MOG <
    > | Bestiaria Support Staff <
    > ============================================================== <
    > Home Page: <http://www.dm.net/~wulfraed/> <
    > Overflow Page: <http://wlfraed.home.netcom.com/> <
     
    Dennis Lee Bieber, Feb 9, 2006
    #5
    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. Peter
    Replies:
    0
    Views:
    3,432
    Peter
    Jul 1, 2003
  2. John Silver
    Replies:
    0
    Views:
    636
    John Silver
    Feb 4, 2005
  3. Tee

    Email ErrorPage to email

    Tee, Jun 23, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    398
  4. Replies:
    3
    Views:
    569
    AdamM
    Jul 27, 2004
  5. Chuck Amadi
    Replies:
    2
    Views:
    421
    chuck amadi
    Jun 6, 2004
Loading...

Share This Page