I am working with smtplib to send emails. However I can't manage to send emails that contain the current time that I get from the time library
import smtplib
from time import strftime, localtime
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(EMAIL, PASSWORD)
time = strftime("%Y-%m-%d %H:%M:%S", localtime())
server.sendmail(SENDER, RECEIVER, "some text " + time)
I can send the email successfully with no error, but it's empty
Note : I can send the email normally without including the time
fixed by adding headers.. This is from another stackoverflow post.
headers = "From: From Person \r\n"
headers += "To: To Person \r\n"
headers += "Subject: \r\n"
headers += "\r\n"
msg = headers + msg