Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 920507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T18:43:33+00:00 2026-05-15T18:43:33+00:00

I’m trying make my first python app. I want make simple email sender form.

  • 0

I’m trying make my first python app. I want make simple email sender form.
In qt designer create a dialog.ui, then generate dialog.py from dialog.ui
and write there function

def SendEmail(self,efrom,eto,esubj,ebody):
    msg = MIMEText( ebody.encode('UTF-8'),'html', 'UTF-8')
    msg['Subject'] = esubj
    msg['From'] = efrom
    msg['To'] = eto
    s = smtplib.SMTP()
    s.connect("mail.driversoft.net", 25)
    s.login("info@mysite.net", "1234567")
    s.sendmail(efrom, [eto], msg.as_string())
    s.quit()

and try connect to the slot

QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL("clicked()"), self.SendEmail("info@mysite.net", "test@mysite.net", "subject", "bodytext"))

when I try start this app, I don’t see a form, on my email revive message, and in console

Traceback (most recent call last):
File "C:\Documents and Settings\a.ivanov\My Documents\Aptana Studio Workspace\test1\src\wxtest.py", line 61, in <module>
ui.setupUi(Dialog)
File "C:\Documents and Settings\a.ivanov\My Documents\Aptana Studio Workspace\test1\src\wxtest.py", line 33, in setupUi
QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL("clicked()"), self.SendEmail("info@mysqite.net", "test@mysite.net", "subject", "bodytext"))
TypeError: arguments did not match any overloaded call:
QObject.connect(QObject, SIGNAL(), QObject, SLOT(), Qt.ConnectionType=Qt.AutoConnection): argument 3 has unexpected type 'NoneType'
QObject.connect(QObject, SIGNAL(), callable, Qt.ConnectionType=Qt.AutoConnection): argument 3 has unexpected type 'NoneType'
QObject.connect(QObject, SIGNAL(), SLOT(), Qt.ConnectionType=Qt.AutoConnection): argument 2 has unexpected type 'bytes'

How can I do a form i wich I wrote subject and text then press Send button and get message by email?
Thanks!

full code

from PyQt4 import QtCore, QtGui
import smtplib
from email.mime.text import MIMEText   

class Ui_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(400, 330)
        self.textEdit = QtGui.QTextEdit(Dialog)
        self.textEdit.setGeometry(QtCore.QRect(10, 70, 381, 221))
        self.textEdit.setObjectName("textEdit")
        self.subjEdit = QtGui.QLineEdit(Dialog)
        self.subjEdit.setGeometry(QtCore.QRect(10, 30, 371, 20))
        self.subjEdit.setObjectName("subjEdit")
        self.pushButton = QtGui.QPushButton(Dialog)
        self.pushButton.setGeometry(QtCore.QRect(100, 300, 75, 23))
        self.pushButton.setObjectName("pushButton")
        self.pushButton_2 = QtGui.QPushButton(Dialog)
        self.pushButton_2.setGeometry(QtCore.QRect(210, 300, 75, 23))
        self.pushButton_2.setObjectName("pushButton_2")
        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(10, 10, 46, 13))
        self.label.setObjectName("label")
        self.label_2 = QtGui.QLabel(Dialog)
        self.label_2.setGeometry(QtCore.QRect(11, 53, 46, 13))
        self.label_2.setObjectName("label_2")

        self.retranslateUi(Dialog)        
        QtCore.QObject.connect(self.pushButton_2, QtCore.SIGNAL("clicked()"), Dialog.close)        
        QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL("clicked()"), self.SendEmail("info@mysite.net", "test@mysite.net", "subject", "bodytext"))
        QtCore.QMetaObject.connectSlotsByName(Dialog)

 #this is my function
    def SendEmail(self,efrom,eto,esubj,ebody):
        msg = MIMEText( ebody.encode('UTF-8'),'html', 'UTF-8')
        msg['Subject'] = esubj
        msg['From'] = efrom
        msg['To'] = eto
        s = smtplib.SMTP()
        s.connect("mail.driversoft.net", 25)
        s.login("info@mysite.net", "1234567")
        s.sendmail(efrom, [eto], msg.as_string())
        s.quit()
        #print("done")

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
        self.pushButton.setText(QtGui.QApplication.translate("Dialog", "Send", None, QtGui.QApplication.UnicodeUTF8))
        self.pushButton_2.setText(QtGui.QApplication.translate("Dialog", "Close", None, QtGui.QApplication.UnicodeUTF8))
        self.label.setText(QtGui.QApplication.translate("Dialog", "Subject", None, QtGui.QApplication.UnicodeUTF8))
        self.label_2.setText(QtGui.QApplication.translate("Dialog", "Email text", None, QtGui.QApplication.UnicodeUTF8))


if __name__ == "__main__":
    import sys
    app = QtGui.QApplication(sys.argv)
    Dialog = QtGui.QDialog()
    ui = Ui_Dialog()
    ui.setupUi(Dialog)    
    Dialog.show()
    sys.exit(app.exec_())
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T18:43:34+00:00Added an answer on May 15, 2026 at 6:43 pm
    QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL("clicked()"), self.SendEmail("info@mysite.net", "test@mysite.net", "subject", "bodytext"))
    

    It is not how SIGNAL-SLOT system works. Your signal “clicked()” have no params — so Your slot must have no params too. And You must pass reference to callback, not call that function in connect.

    QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL("clicked()"), self.pushButtonClicked)
    
    def pushButtonClicked(self):
        self.SendEmail("info@mysite.net", "test@mysite.net", "subject", "bodytext")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 502k
  • Answers 502k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer And a PHP version for completeness. It won't drop anything,… May 16, 2026 at 2:28 pm
  • Editorial Team
    Editorial Team added an answer setException probably isn't made for overriding, but is provided to… May 16, 2026 at 2:28 pm
  • Editorial Team
    Editorial Team added an answer At runtime, every object knows what its own class is,… May 16, 2026 at 2:28 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have just tried to save a simple *.rtf file with some websites and
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.