Gabriel Genellina wrote:
Lorenzo Thurman wrote:
>I'm using the Mimewriter and mimetools modules to create html messages.
They work OK, except that when the messages are received, they always
have the timestamp of 12/31/1969. I've looked through both packages and
can't find anything that would allow me to manually set it. Can someone
help me out?
The date goes into the message headers, like From, To, Subject...
message.add_header("Date", "Thu, 22 Jun 2006 23:18:15 -0300")
--
Gabriel Genellina
Thanks for the reply. When I try this though, I get an error:
Traceback (most recent call last):
File "./synctest.py", line 202, in ?
message = createhtmlmail(html, text, subject)
File "./synctest.py", line 49, in createhtmlmail
writer.addheader("Date", theDate)
File "/usr/lib/python2.4/MimeWriter.py", line 100, in addheader
lines = value.split("\n")
AttributeError: 'datetime.datetime' object has no attribute 'split'
I'm trying to use a variable for the date, since of course, it should
always be 'now'.
someDate = datetime.datetime.now()
writer.addheader("Date", someDate)
Hard coding a date, like your example, works just fine.
Any ideas?