我已经编写了一个发送文本电子邮件的代码,但是它没有显示任何错误,也没有将电子邮件发送到目标地址。
#!/usr/bin/python
import smtplib
sender = 'from@fromdomain.com'
receivers = ['to@todomain.com']
message = "hi"
smtpObj = smtplib.SMTP('localhost')
smtpObj.sendmail(sender, receivers, message)
print "Successfully sent email"