Where O Where Could My VARIABLE Be?

Putland, Karl KPutland at servicemagic.com
Fri May 4 11:28:32 EDT 2001


> -----Original Message-----
> From: Ben Ocean [mailto:zope at thewebsons.com]
> Subject: Where O Where Could My VARIABLE Be?
> 
> 
> Hi;
> Why does this send me a blank email when the file has information??
>  >>>
> #!/usr/bin/python
> 
> import cgi, os
> import string
> import smtplib
> 
> print "Content-type: text/html\n\n"
> file = open("outfile.txt", "r")
> line = file.readline()
> file.close()
> server = smtplib.SMTP("localhost")
> server.sendmail("beno at thewebsons.com", "beno at thewebsons.com", line)
> server.quit()


This should get you what you want.

server.sendmail("beno at thewebsons.com", "beno at thewebsons.com", 'Subject: My
line\n\n%s' % line)

The third argument needs to be a valid rfc822 message.

--Karl




More information about the Python-list mailing list