problem with a python script

gbreed at cix.compulink.co.uk gbreed at cix.compulink.co.uk
Tue Nov 20 11:41:49 EST 2001


Felix Seeger wrote:

> Here is the part of the code:
> 
> 
> class Mail:
>         def __init__(self,outserver="localhost"):
>                 import smtplib
>                 self.outserver=outserver
> 
>         def sendmail(self,from,to,msg,mopts="",rcptopts=""):
>                 s=smtplib.SMTP(outserver)
>                 s.sendmail(from,to,msg,mopts,recptopts)
>                 s.quit()

It must have been written for an old interpreter where "from" wasn't a 
keyword.  Try changing the sendmail method to

         def sendmail(self,fromadddr,to,msg,mopts="",rcptopts=""):
                 s=smtplib.SMTP(outserver)
                 s.sendmail(fromaddr,to,msg,mopts,recptopts)
                 s.quit()




More information about the Python-list mailing list