mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
When sending email add a Date: header so that amavis does not consider the emails to be spam
This commit is contained in:
commit
d9fc91c5c4
@ -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(localtime=True)
|
||||||
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