Use email.utils.formatdate() for dates in headers
This commit is contained in:
parent
4a45a9360b
commit
226fd75a55
1 changed files with 3 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
import uuid
|
||||
import json
|
||||
|
||||
from datetime import datetime
|
||||
from email.utils import formatdate
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
|
@ -21,9 +21,9 @@ class SmtpdHandler:
|
|||
try:
|
||||
with open(Path(self.config.maildir) / f"{eid}.eml", "wb") as mailfile:
|
||||
mailfile.write(
|
||||
f"From {envelope.mail_from} {datetime.now().isoformat()}\n".encode())
|
||||
f"From {envelope.mail_from} {formatdate()}\n".encode())
|
||||
mailfile.write(
|
||||
f"Received: from {session.host_name} ({session.peer[0]}) by {server.hostname} (Kumi Systems FileMailer) id {eid}; {datetime.now().isoformat()}\n".encode())
|
||||
f"Received: from {session.host_name} ({session.peer[0]}) by {server.hostname} (Kumi Systems FileMailer) id {eid}; {formatdate()}\n".encode())
|
||||
mailfile.write(envelope.original_content)
|
||||
with open(Path(self.config.maildir) / f"{eid}.json", "w") as jsonfile:
|
||||
data = {
|
||||
|
|
Loading…
Reference in a new issue