Hi:
I'm new to python and wxpython, and I'm trying to make
a program to send mail. I'm using what follows:
class MyFrame1(wx.Frame):
    def __init__(self, *args, **kwds):
    ...
    self.message = wx.TextCtrl(self.panel_1, -1, "")
    self.button_1 = wx.Button(self.panel_1, -1, "SEND
Mail")
    ...
    # And then:
    wx.EVT_BUTTON(self,self.button_1.GetId(),
self.Mail)

    # The Mail method is:
    def Mail(self,event):
       self.from = "[EMAIL PROTECTED]"
       self.host = "localhost"
       self.to = "[EMAIL PROTECTED]"

       self.body = self.message

       server = smtplib.SMTP(self.host)
       server.sendmail(self.from, [self.to],
self.body)
       server.quit()

But when pressing the Send Mail button I only get:
TypeError: len() of unsized object

Anybody knows what I'm doing wrong? Maybe I'm not
getting the user input, or just dont know how to use
that input in the Mail method...

Because if I use:
def Mail(self,event):
   self.from = "[EMAIL PROTECTED]"
   self.host = "localhost"
   self.to = "[EMAIL PROTECTED]"

   self.body = "any message" #as string everything
works fine.

   server = smtplib.SMTP(self.host)
   server.sendmail(self.from, [self.to], self.body)
   server.quit()

Thanks in advanced.
Daniel Queirolo.




                
______________________________________________ 
Renovamos el Correo Yahoo! 
Nuevos servicios, más seguridad 
http://correo.yahoo.es
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to