473,398 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Mail not setting timestamp

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?
TIA
Apr 7 '07 #1
4 1499
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

Apr 7 '07 #2
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?
Apr 7 '07 #3
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

Apr 7 '07 #4
Gabriel Genellina wrote:
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
Got it!
thx
Apr 7 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
0
by: James Foreman | last post by:
Looking at the documentation on EXPORT, when exporting a date column it will automatically use yyyymmdd. One could choose to use ISO format, but unfortunately the client I'm exporting to can't...
11
by: Zlatko Matić | last post by:
Hello. I have a MS Access front-end working with PostgreSQL database. I have successfully created saved File DSN. My paa-through queries are referring to that file as well as linked tables. But I...
1
by: AtPCLogic | last post by:
Hi, I'm not usually programming in C, so I'm lost and need a little help. I need to copy a file from one directory to another and preserve the timestamp. The OS is Windows 32 bit, including XP,...
3
by: Barbara Lindsey | last post by:
I have a case where I am collecting a "Start Date" and an "End Date". I would like to default the "End Date" to the "Start Date" value if only the "Start Date" is entered. I tried setting this as...
6
by: rekaeps | last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles sending e-mail from the server when accessing the web site from a separate client computer. Also, in the same scenario,...
1
by: Zeba | last post by:
Hi! I have an application in which a user searches for a particular item as - He enteres the keyword in home.html and views the results in searchresults.aspx.I want to uniquely identify the...
2
by: gezerpunta | last post by:
Hi I used pear api to make this mail but I can t add multipart.My mail structure is like that. part 1: a file part 2: multipart part 1: a file part 2: a file
7
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
I'm not sure whether I'm missing something or not. I reviewed the SQL Statements generated by tableadapter when the selectcommand is select *. It seems they are extremely bad. The updatecommand...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.