2015-06-28 37 views
0

我想爲新創建的Maildir消息設置日期。 但是,記錄的方法'set_date'似乎不起作用。如何設置郵箱中新郵件的發送時間?

msg = mailbox.MaildirMessage() 
sec = 1435512303.0 
origin = "Sender" 

# doesn't seem to work 
msg.set_unixfrom('{0} {1}'.format(origin, sec)) 

# doesn't seem to work either 
msg.set_date(sec) 

我在看什麼?

回答

1

要設置發送時間,您必須操作標題。

msg.__setitem__('Date', 
       time.strftime("%a, %d %b %Y %H:%M:%S %z", 
           entry_time)) 
相關問題