Python / CGI / E-mail problem

Sreekant Kodela sreekant at uklinux.net
Mon May 15 21:48:17 EDT 2000


Hi there

I am trying to send automated emails to the people who joined the
mailing list. I am using the smtplib and sending the mail but my users
came back to me that they can see the code. I tried to mail it to my
self and hotmail was ok but pop/kmail was showing the code. I am using
the following method. Is there anything stupid I'm doing!!

hdr='From: xxxxx'+smtplib.CRLF+'SUBJECT: xxxxxx'+smtplib.CRLF
hdr2='<html><head><title>StokZilla</title></head><body
bgcolor="#ffffff"><H3>FreeMailingList</H3>'
hdr2=hdr2+'<h2>
'+time.asctime(time.gmtime(time.time()))+'</h2><br><hr><br><i>If there
is any problem with the email / report etc  \
                    please inform the webmaster from   <a
href="http://www.stokzilla.uklinux.net">homepage</a> or alternately mail
the <a   \
                    href="mailto:skodela at hotmail.com">author.</a><table
border="1">'
hdr3='</table></body></html>'
def makemsg(rep,ta):
 try:
     msg=''
     for n in rep:
      if len(n)>2:

msg=msg+('<tr><td>'+`stripper(n[0])`+'</td><td>'+`stripper(n[1])`+'</td><td>'+`stripper(n[2])`+'</td></tr>')

     msg=hdr+hdr2+msg+hdr3
     s=smtplib.SMTP('localhost')
     s.sendmail('stokzilla at localhost',"skodela at uklinux.net",msg)
     s.close()
      print '<p>sending mail to '+ta
 except:
  pass

Please help.
Thanks
Sreekant

PS: Stripper() is just a return string.replace(string.strip(x),'"','')






More information about the Python-list mailing list