Mail not setting timestamp

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sat Apr 7 15:14:52 EDT 2007


Lorenzo Thurman wrote:
> 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
> >>
> > The date goes into the message headers, like From, To, Subject...
> > message.add_header("Date", "Thu, 22 Jun 2006 23:18:15 -0300")
> >
> Thanks for the reply. When I try this though, I get an error:
> 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'.

You have to convert the date into a string, using the right format.
The docs for the time module have a recipe:
http://www.python.org/doc/current/lib/module-time.html
(look for RFC 2822)

--
Gabriel Genellina




More information about the Python-list mailing list