2014-04-20, 22:00
Hello all i just wanted to share a little script that i made that will allow you to send emails from XBMC using python.
Here is the script for anyone that is interested :
To set your email server and port just use :
But change around the PORT and SERVER to what you want.
For example to use Hotmail you could use :
And here is how you set your email address that you will send it from :
And your password :
When sending an email you can input the email address by using :
For the email's subject you can use :
And as for the actual message you can just use :
Then when you want to send the email just run the python script above.
Feel free to change anything around and integrate this in to any of your plugins/skins or whatever
Here is the script for anyone that is interested :
PHP Code:
import smtplib
to = xbmc.getInfoLabel( '$INFO[Skin.string(EmailTo)]' )
gmail_user = xbmc.getInfoLabel( '$INFO[Skin.string(MyEmail)]' )
gmail_pwd = xbmc.getInfoLabel( '$INFO[Skin.string(MyPassword)]' )
msg = xbmc.getInfoLabel( '$INFO[Skin.string(MyMessage)]' )
sub = xbmc.getInfoLabel( '$INFO[Skin.string(MySubject)]' )
server = xbmc.getInfoLabel( '$INFO[Skin.string(EmailServer)]' )
port = xbmc.getInfoLabel( '$INFO[Skin.string(ServerPort)]' )
smtpserver = smtplib.SMTP(server,port)
smtpserver.ehlo()
smtpserver.starttls()
smtpserver.ehlo
smtpserver.login(gmail_user, gmail_pwd)
header = 'To:' + to + '\n' + 'From: ' + gmail_user + '\n' + 'Subject:' + sub + '\n'
print header
msg = header + '\n' + msg + '\n\n'
smtpserver.sendmail(gmail_user, to, msg)
print 'done!'
smtpserver.close()
To set your email server and port just use :
PHP Code:
Skin.SetString(ServerPort, PORT)
Skin.SetString(EmailServer, SERVER)
But change around the PORT and SERVER to what you want.
For example to use Hotmail you could use :
PHP Code:
Skin.SetString(ServerPort, 25)
Skin.SetString(EmailServer, smtp.live.com)
And here is how you set your email address that you will send it from :
PHP Code:
Skin.SetString(MyEmail)
And your password :
PHP Code:
Skin.SetString(MyPassword)
When sending an email you can input the email address by using :
PHP Code:
Skin.SetString(EmailTo)
For the email's subject you can use :
PHP Code:
Skin.SetString(MySubject)
And as for the actual message you can just use :
PHP Code:
Skin.SetString(MyMessage)
Then when you want to send the email just run the python script above.
Feel free to change anything around and integrate this in to any of your plugins/skins or whatever