有人可以告诉我,下面的代码有什么问题吗?TIA :)))
import smtplib
if raw_input("if you want to send a message from a gmail account, type yes: ") == 'yes':
try:
sender = raw_input("from:\n")
senders_pwd = raw_input("password:\n")
recipient = raw_input("to:\n")
print 'ok, now compile your message:'
subject = raw_input("subject:\n")
body = raw_input("your message:\n")
message = "subject: %s\n%s" %(subject,body)
server = smtplib.SMTP("smtp.gmail.com",587)
server.ehlo()
server.starttls()
server.ehlo()
print "ok, I've sent your email"
except:
print 'failed to send'