Ok so The script is now working, Id like to thank all for the advice.
heres the final script
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('[email protected]','somepwd')
mailserver.sendmail('[email protected]','[email protected]',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")
So, just to let you know that im using live mail which works on port 25. Tried and tested on both windows and linux and openelec. Working fine.
Maybe something along the lines of an if statement? So only if one of these words are given, then do the rest, otherwise do not accept.
list = ["simon", "tom", "sarah", "peter", "jane"]
word = input()
if word.lower() in list:
print('Ok')
#continue with rest of program
else:
print('No, sorry')