#!\usr\bin\env python  
#-*- coding: utf-8 -*- 
import web,os
def send_mail(send_to, subject, body, cc=None, bcc=None):  
    try:  
        web.config.smtp_server = 'smtp.163.com'
        web.config.smtp_port = 25     
        web.config.smtp_username = '18291763097@163.com'     
        web.config.smtp_password = 'oxxsliyawaecjhds'
        web.config.smtp_starttls = True
        send_from = '18291763097@163.com'        
        web.sendmail(send_from, send_to, subject, body, cc=cc, bcc=bcc)  
        return 1 
    except Exception ,e:  
        print e  
        return -1   
if __name__=='__main__':  
    f=open('/home/pi/xiangmu/youjian/youjian.txt') 
    s=f.readline()
    f.close()
    send_to = '1102842479@qq.com'
    subject = '图灵管家'
    #body=raw_input("输入邮件内容:")
    #body = '老曹，我是图灵机器人，欢迎为你服务'
    body=s
    print s
    print ("发送成功！")
    os.system('omxplayer /home/pi/xiangmu/youjian/youjian.mp3') 
    send_mail(send_to, subject, body) 
