Help, re SMTP posting / RFC822

Siggy Brentrup bsb at baal.infodrom.north.de
Fri Sep 17 09:43:06 CEST 1999


junkster at nospam.rochester.rr.com (Benjamin Schollnick) writes:


[...]


> 1)         def mail_to (self, persons_to_mailto):
> 		tmp = ''
> 		tmp = string.splitfields(persons_to_mailto, ',')
> 		self.to_text = 'To: '
> 		for count in range(len(tmp)):
> #			self.to_text = self.to_text + '<' 
> 			self.to_text = self.to_text + tmp[count] 
> #			self.to_text = self.to_text + '\x3E' 
> 			self.to_text = self.to_text + '\n'

> 	See the two commented lines?  I can't get them to work in
> 	*ANY* form.  If I have the < or > charactern 'em, python just
> 	seems to goof up and no value gets placed into TO_TEXT.

What's your test environment? I suspect you are feeding the output
into a HTML browser, DON'T IF IT'S NOT ABSOLUTELY NECESSARY, and if so 
enclose it in <pre> ... </pre>.

> 	I seem to remember the Greater & Less signs having a special
> 	representation code (i.e. \n) in python but can't back it up
> 	with documentation.  (I looked but couldn't find it).

Probably you mean `&lt;' `&gt;' in HTML

[...]


> 3)    Anyone got any suggestions on making this code "more intuitive"
> 	or better python code?  It's simplistic I know, but I'm still
> 	getting the hang of python and trying to supress my Borland
> 	Pascal OOP experience(s).

Reuse existing code! Have a look at the rfc822 and related modules,
for CGI look at the quite well documented CGI module. Study example
code and get (and study) a good book about Python programming,

    	cf. http://www.python.org/psa/bookstore/

On an aside: I just had to look into Delphi code for a Win32 project,
    nice looking IDE, but it lacks MI <gr>. For RAD I still prefer
    python w/ Tkinter and Pmw.

CU
  Siggy





More information about the Python-list mailing list