[Evolution] Recieved date and mbox



Hi

I have made a small python hack to receive mail from cron etc. Se below.
This script writes to an mbox at /var/mail/root.
Cron happily delivers to this, thus saving me form having to install
postfix or sendmail for that _one_ mail a day.

I have configured an Evolution account for local delivery to read that
file, and that works fine.

However I cannot for the life of me make make Evolution recognize any
kind of received date. The received column only shows "?".

Any developers her who can tell me what's required?

Any other improvements to the script are welcome as well :)

Regards

Gaute Amundsen


symlinked as /usr/sbin/sendmail
-
#!/usr/bin/python
import mailbox
import sys
import email
from time import gmtime, strftime

mbox = mailbox.mbox('/var/mail/root', factory=None, create=True)
msg = email.message_from_file(sys.stdin)
t = email.Utils.formatdate(localtime=False) 

#msg['Recieved']= 'from localhost (sendmail_fake.py) by me (fake) for
<root localhost>; %s ' % t

msg['Return-path'] = '<root localhost>'
msg['From'] = 'root localhost'
msg['Date']=t
mbox.add(msg)
sys.exit()

-
sendmail_test.py
-
#!/usr/bin/python
SENDMAIL = "/usr/sbin/sendmail" # sendmail location

import os
p = os.popen("%s -t" % SENDMAIL, "w")
#p.write("From: root localhost\n")
p.write("To: my real addr\n")
p.write("Subject: test\n")
p.write("\n") # blank line separating headers from body
p.write("Some text\n")
p.write("some more text\n")
sts = p.close()
if sts != 0:
    print "Sendmail exit status", sts





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