Python 2.6.6 on CentOS 6

I'm in section 3.4.12 of Wesley Chun's "Core Python Applications Programming". The POP3 stuff works but I can't seem to get the SMTP to connect, it just hangs and then times out. Running it in IDLE gets the same thing. Have also tried with the port # set, as well.

Thoughts?

Leam

####

#!/usr/bin/env python

from smtplib import SMTP
from poplib import POP3
from time import sleep

SMTPSVR = 'my.smtpserver.com'
POP3SVR = 'my.smtpserver.com'

who = '[email protected]'


user = 'me+smtpserver.com'
pass_ = 'my_super_secret'

body = '''\
From: %(who)s
To: %(who)s
Subject: test e-mail

Hello world!
''' % {'who' : who }

send_svr = SMTP(SMTPSVR)
errs = send_svr.sendmail(who, [who], body)
send_svr.quit()

assert len(errs) == 0, errs

print "Starting sleep"

sleep(10)

recv_svr = POP3(POPSVR)
recv_svr.user(user)
recv_svr.pass_(pass_)
rsp, msg, siz = recv-svr.retr(recv_svr.stat()[0])
recv_svr.quit()
sep = msg.index('')
recv_body = msg[sep+1:]
recv_svr.quit()
assert body == recv_body
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to