import poplib
M = poplib.POP3_SSL('pop3.live.com', 995) #Connect to hotmail pop3 server
try:
M.user(raw_input("username: ")) #Get the username from the standar input
M.pass_(raw_input("password: ")) #Get the password from the standar input
except:
print "username or password incorrect"
else:
print "Successful login"
import smtplib
msg = "warning"
msg['From'] = "capstons2011jm4@hotmail.com"
msg['To'] = "yuxun88@hotmail.com"
msg['Subject'] = "hello"
s = smtplib.SMTP("smtp.live.com",25)
s.sendmail("capstones2011jm4@hotmail.com", "yuxun88@hotmail.com", msg.as_string())
s.quit()
我非常了解如何使用 python 登录 hotmail。
但是我仍然无法在hotmail中发送电子邮件。
TypeError: 'str' object does not support item assignment This keep coming up. I have no idea why.
有谁知道如何编写以下代码。请帮忙。我会很感激的。