求教邮件发送!!!

求教邮件发送!!!

windows下邮件发送应该怎么写啊?
import smtplib
def prompt(prompt):
    return raw_input(prompt).strip()
fromaddr=prompt("From: ")
toaddrs=prompt("To: ").split()
print "Enter message,end with ^D(Unix) or ^z(Windows):"
msg=("From: %s\r\nTo: %s\r\n\r\n"
     %(fromaddr,", ".join(toaddrs)))
while 1:
    try:
        line=raw_input()
    except EOFError:
        break
    if not line:
        break
    msg=msg+line
print "Message length is"+repr(len(msg))
server=smtplib.SMTP("smtp.163.com","xxxx","xxxxxx")
server.set_debuglevel(1)
server.sendmail(fromaddr,toaddrs,msg)
server.quit()
帮我看看这个代码有什么错,我运行后会出现下面的错误:
Traceback (most recent call last):
  File "F:/python/sendmail1.py", line 18, in -toplevel-
    server=smtplib.SMTP("smtp.163.com","xxxxx","xxxxx")
  File "D:\Python24\lib\smtplib.py", line 244, in __init__
    (code, msg) = self.connect(host, port)
  File "D:\Python24\lib\smtplib.py", line 292, in connect
    for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
gaierror: (10109, 'getaddrinfo failed')
帮忙看看啊。谢谢!

希望这个对你有帮助。

http://blog.czug.org/panjy/2006/6/dui163youxiangdezhichi
我根据这个做了修改,但是邮件还是发送不出去。我想请问一下在WINDOWS下发送邮件具体应该要分几个步骤?
楼主居然把密码也公布出来了,汗