A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/322142.html below:

reg email packages work

reg email packages work reg email packages workTim Roberts timr at probo.com
Fri Sep 2 03:14:01 EDT 2005
praba kar <prabapython at yahoo.co.in> wrote:
>
>       I am working in web based email system project.
>Here I try to build email message
>from scratch. I used below code to build email
>message
>
>   msg =  email.MIMEBase('text','html')
>   msg['Return-Path'] = user+'@'+domain
>   msg['Date'] = formatdate(localtime=1)
>   msg['Subject'] =  subject
>   msg['From'] = from_name
>   msg['To'] = to
>   msg['Cc'] = cc
>   msg.set_payload("Body of the email messagge")
>   fh = os.popen('/bin/sendmail  %s'% (eachid),'w')
>   fh.write(msg.as_string())
>   fh.close()
>
>This code will build plain email message properly.

No, it doesn't.  It builds an HTML message (see the very first line).  If
you supply plain text to this as the body of the message, all the lines
will be concatenated together, which sounds a lot like what you are seeing.

If you are not feeding HTML as the body, change the fist line to
('text','plain').
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4