def _showDialog(self):
        text, ok = QtGui.QInputDialog.getText(self, 'Email Input',
            'Insira seu email')

        if ok:
            emailsender = EmailSender('smtp.gmail.com', 587)
            print(str(text))
            try:
                emailsender.login("*****@*****.**", "QpG-6ey-EJu-DwP")
                print self.path_to_email
                emailsender.send_with_attachment(str(text), "Teste de envio com software", "body", self.path_to_email)
                emailsender.quit()
            except Exception, e:
                print "Error!"
                print str(e)
示例#2
0
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from EmailSender import *

emailsender = EmailSender('smtp.gmail.com', 587)

try:
    emailsender.login("fromaddr", "password")
    emailsender.send_with_attachment("toaddr", "subject", "body", "file_path")
    emailsender.quit()
except Exception, e:
    print "Error!"
    print str(e)