好的,脚本现在正在运行,我要感谢所有人的建议。
这是最终的脚本
import smtplib
import xbmc
import xbmcgui
import datetime
list = ("mary", "james", "tilly")
kb = xbmc.Keyboard('', 'Please type in your name to continue')
kb.doModal()
typedin = kb.getText()
if typedin.lower() in list:
now = datetime.datetime.now()
runtime = now.strftime("%Y-%m-%d %H:%M")
content = xbmc.executebuiltin('kb.getText()')
mailserver = smtplib.SMTP("smtp.mail.com",25)
mailserver.ehlo()
mailserver.starttls()
mailserver.login('mail@somemail.com','somepwd')
mailserver.sendmail('mail@somemail.com','mail@somemail.com',typedin + ' has run proggy ' + runtime)
mailserver.close()
xbmc.executebuiltin("Notification(An email has been sent, yada yada yada,()")
else:
xbmc.executebuiltin("THE INPUTTED NAME, IS NOT VALID,()")
xbmcgui.Dialog().ok(
"Please try again - User name not correct",
"The input yada yada",
"yada yada",
"yada yada")
所以,只是为了让你知道我正在使用在端口 25 上工作的实时邮件。在 windows 和 linux 和 openelec 上都进行了尝试和测试。工作正常。