Python / CGI / E-mail problem
ben at co.and.co
ben at co.and.co
Tue May 16 16:41:33 EDT 2000
Sreekant Kodela <sreekant at uklinux.net> wrote:
> Hi there
>
> I tried using the MimeWriter but failed. Do you have any simple exampe by
> any chance.
>
> thanks
> sreekant
I've never used smtplib nor MimeWriter, and it appears MimeWriter
isn't necessary at all. Try this one, as a test (fill in the obvious
ones):
----------------------------------------------------------------------
#!/usr/bin/python
import smtplib
your_email_address = '____'
your_server = '127.0.0.1'
test_message = '''From: %s\r
To: %s\r
Subject: ILOVEYOU\r
MIME-Version: 1.0\r
Content-Type: text/html; charset=iso-8859-1\r
Content-Transfer-Encoding: 8bit\r
Content-Disposition: inline\r
\r
\r
<html>\r
<body>\r
<h1>Hello %s</h1>\r
</body>\r
</html>\r
''' % (your_email_address, your_email_address, your_email_address)
con = smtplib.SMTP(your_server)
con.sendmail('From: %s' % your_email_address,
'To: %s' % your_email_address,
test_message)
con.quit()
---------------------------------------------------------------------
Greetings,
--
ben . de . rydt at pandora . be ------------------ your comments
http://users.pandora.be/bdr/ ------- inl. IPv6, Linux en Pandora
More information about the Python-list
mailing list