Kaydet (Commit) e9719fe1 authored tarafından Fred Drake's avatar Fred Drake

Fix bug in smtplib example: the prompt said to end the message with ^D,

but doing so raised EOFError.  This makes it work as advertised and
converts to string methods where reasonable.

This closes SF bug #424776.
üst 09daff45
......@@ -241,17 +241,20 @@ import smtplib
import string
def prompt(prompt):
return string.strip(raw_input(prompt))
return raw_input(prompt).strip()
fromaddr = prompt("From: ")
toaddrs = string.split(prompt("To: "))
toaddrs = prompt("To: ").split()
print "Enter message, end with ^D:"
# Add the From: and To: headers at the start!
msg = ("From: %s\r\nTo: %s\r\n\r\n"
% (fromaddr, string.join(toaddrs, ", ")))
while 1:
line = raw_input()
try:
line = raw_input()
except EOFError:
break
if not line:
break
msg = msg + line
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment