Module mail : Add Date header (#59080)

* Mail module : add date header (#58808)
pull/59150/head
Jonathan 5 years ago committed by Brian Coca
parent de66abe521
commit f0eaf1fb39

@ -0,0 +1,2 @@
minor_changes:
- Add date header to the email based on local time in mail module (https://github.com/ansible/ansible/issues/58808).

@ -203,7 +203,7 @@ import smtplib
import ssl
import traceback
from email import encoders
from email.utils import parseaddr, formataddr
from email.utils import parseaddr, formataddr, formatdate
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
@ -326,6 +326,7 @@ def main():
msg = MIMEMultipart(_charset=charset)
msg['From'] = formataddr((sender_phrase, sender_addr))
msg['Date'] = formatdate(localtime=True)
msg['Subject'] = Header(subject, charset)
msg.preamble = "Multipart message"

Loading…
Cancel
Save