Send emails from your skin
#1
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 :

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_usergmail_pwd)
header 'To:' to '\n' 'From: ' gmail_user '\n' 'Subject:' sub '\n'
print header
msg 
header '\n' msg '\n\n'
smtpserver.sendmail(gmail_usertomsg)
print 
'done!'
smtpserver.close() 

To set your email server and port just use :
PHP Code:
Skin.SetString(ServerPortPORT)
Skin.SetString(EmailServerSERVER

But change around the PORT and SERVER to what you want.

For example to use Hotmail you could use :
PHP Code:
Skin.SetString(ServerPort25)
Skin.SetString(EmailServersmtp.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 Smile
Reply

Logout Mark Read Team Forum Stats Members Help
Send emails from your skin0