I'm working on learning various aspects of Py coding, and happened to review
the smtplib docs this morning.
I entered the sample code from
http://www.python.org/doc//current/library/smtplib.html
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):"
# Add the From: and To: headers at the start!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('localhost')server.set_debuglevel(1)server.sendmail(fromaddr,
toaddrs, msg)server.quit()
and it returns -
"TypeError" with no other information...
It appears to be generated from the line
msg = ("From: %s\r\nTo: %s\r\n\r\n"
% (fromaddr, ", ".join(toaddrs)))
But I'm not sure why...
Any input is appreciated.
--
http://mail.python.org/mailman/listinfo/python-list