add Date header, close #42
This commit is contained in:
parent
232e2fb474
commit
fc984bb656
@ -9,6 +9,7 @@ import json
|
|||||||
import socket
|
import socket
|
||||||
import smtplib
|
import smtplib
|
||||||
|
|
||||||
|
from email.utils import formatdate
|
||||||
from email.header import Header
|
from email.header import Header
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
|
|
||||||
@ -73,7 +74,6 @@ class SMTP(object):
|
|||||||
|
|
||||||
def format(self, thread, comment):
|
def format(self, thread, comment):
|
||||||
|
|
||||||
|
|
||||||
rv = io.StringIO()
|
rv = io.StringIO()
|
||||||
|
|
||||||
author = comment["author"] or "Anonymous"
|
author = comment["author"] or "Anonymous"
|
||||||
@ -122,6 +122,7 @@ class SMTP(object):
|
|||||||
msg = MIMEText(body, 'plain', 'utf-8')
|
msg = MIMEText(body, 'plain', 'utf-8')
|
||||||
msg['From'] = "Ich schrei sonst! <%s>" % from_addr
|
msg['From'] = "Ich schrei sonst! <%s>" % from_addr
|
||||||
msg['To'] = to_addr
|
msg['To'] = to_addr
|
||||||
|
msg['Date'] = formatdate(localtime=True)
|
||||||
msg['Subject'] = Header(subject, 'utf-8')
|
msg['Subject'] = Header(subject, 'utf-8')
|
||||||
|
|
||||||
with self as con:
|
with self as con:
|
||||||
|
Loading…
Reference in New Issue
Block a user