mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
smtp: add Date header as required for rfc5322
this prevents from bad header classifications in mail filters
This commit is contained in:
parent
983a3a76c5
commit
7519a43d8f
@ -18,11 +18,13 @@ def create_mail(from_, to, subject, text=None, attachment_data=None,
|
|||||||
assert text or attachment_data
|
assert text or attachment_data
|
||||||
|
|
||||||
from email.mime.multipart import MIMEMultipart
|
from email.mime.multipart import MIMEMultipart
|
||||||
|
from email.utils import formatdate
|
||||||
|
|
||||||
outer = MIMEMultipart()
|
outer = MIMEMultipart()
|
||||||
outer['Subject'] = subject
|
outer['Subject'] = subject
|
||||||
outer['To'] = to
|
outer['To'] = to
|
||||||
outer['From'] = from_
|
outer['From'] = from_
|
||||||
|
outer['Date'] = formatdate()
|
||||||
outer.preamble = 'You will not see this in a MIME-aware mail reader.\n'
|
outer.preamble = 'You will not see this in a MIME-aware mail reader.\n'
|
||||||
|
|
||||||
if text is not None:
|
if text is not None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user