Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MIMEText breaking the rules?


  • From: dale at riverhall.nospam.co.uk (Dale Strickland-Clark)
  • Subject: MIMEText breaking the rules?
  • Date: Wed, 01 Aug 2007 11:56:22 +0100

The email module's mimetext handling isn't what you might expect from
something that appears to behave like a dictionary.

$ python
Python 2.5 (r25:51908, May 25 2007, 16:14:04)
[GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from email.mime.text import MIMEText
>>> msg = MIMEText("A message")
>>> msg["To"] = "recipient at myhost.com"
>>> msg["To"] = "other_recipient at myhost.com"
>>> print msg.as_string()
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
To: recipient at myhost.com
To: other_recipient at myhost.com

A message
>>>

Having apparently REPLACED my recipient, what I've ended up with is both of
them.

-- 
Dale Strickland-Clark
Riverhall Systems - www.riverhall.co.uk