I'm with a problem that I don't know the cause.
I'm sending e-mails with Python and all emails are dated from 1970-01-01 01:00
Here is the code:
def send_email(self, host, port, username, password, frommail, tomail, subject, message):
msg = MIMEText(message)
msg['Subject'] = subject
msg['From'] = frommail
msg['To'] = tomail
s = smtplib.SMTP(host, port)
s.login(username, password)
s.sendmail(frommail, [tomail], msg.as_string())
s.quit()
I'm using Ubuntu 12.04, I've checked the system date and it is ok. Any ideas of what might be causing this?
Best Regards,
You don't have a
msg['Date'] = ...
in your code.
Try
msg['Date'] = email.utils.formatdate(localtime=True)
for adding the send date. See here.