在kivy发送电子邮件不起作用

时间:2015-04-25 17:56:28

标签: android python email

我已经编写了下面的代码并将其保存为main.py然后通过buildozer我制作了apk文件并在我的手机中部署但它崩溃了....为什么?

from kivy.app import App
from kivy.uix.button import Button
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
import smtplib
fromaddr = "nisargjani20996@gmail.com"
toaddrs  = "nisargjani20996@gmail.com"
msg = "Why,Oh why!"
username = "myfrien@gmail.com"
password = "password"
server = smtplib.SMTP('smtp.gmail.com:587')

def callback(instance):     
     server.starttls()
     server.login(username,password)    
     server.sendmail(fromaddr, toaddrs, msg)
     server.quit()

class TestApp(App):
    def build(self):
        b=Button(text='press me')
        b.bind(on_press=callback)
        return b    

if __name__ == '__main__':
    TestApp().run()

1 个答案:

答案 0 :(得分:0)

尝试在buildozer.spec中设置android.permissions = INTERNET