Mail not setting timestamp

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lorenzo Thurman

    #1

    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
  • Gabriel Genellina

    #2
    Re: Mail not setting timestamp

    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_hea der("Date", "Thu, 22 Jun 2006 23:18:15 -0300")

    --
    Gabriel Genellina

    Comment

    • Lorenzo Thurman

      #3
      Re: Mail not setting timestamp

      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_hea der("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.addheade r("Date", theDate)
      File "/usr/lib/python2.4/MimeWriter.py", line 100, in addheader
      lines = value.split("\n ")
      AttributeError: 'datetime.datet ime' 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.dateti me.now()
      writer.addheade r("Date", someDate)
      Hard coding a date, like your example, works just fine.
      Any ideas?

      Comment

      • Gabriel Genellina

        #4
        Re: Mail not setting timestamp

        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_hea der("Date", "Thu, 22 Jun 2006 23:18:15 -0300")
        Thanks for the reply. When I try this though, I get an error:
        AttributeError: 'datetime.datet ime' 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:

        (look for RFC 2822)

        --
        Gabriel Genellina

        Comment

        • Lorenzo Thurman

          #5
          Re: Mail not setting timestamp

          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_h eader("Date", "Thu, 22 Jun 2006 23:18:15 -0300")
          >>>
          >Thanks for the reply. When I try this though, I get an error:
          >AttributeError : 'datetime.datet ime' 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:

          (look for RFC 2822)
          >
          --
          Gabriel Genellina
          >
          Got it!
          thx

          Comment

          Working...