Python Forum
smtplib send email has no timestamp
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
smtplib send email has no timestamp
#1
I want to send emails to customers automatically. So I am testing with just 5 email addresses to see how it works

I import these

import smtplib, ssl
import json # for a list of email addresses
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
One test email did not get sent, the problem was:

Quote:No Mx Record Found

Must be a wrong email, because even when I tried to send from my email it bounced back!

But i noticed this: the time of the email which I sent from this laptop is the start of the computer epoch time (well, not quite):

Quote:时 间:1970-01-01 07:59:59
Time: 1970-01-01 07:59:59

My laptop shows the current time OK!

How can I get smtplib to put the current timestamp?

This sends the emails from my laptop via my QQ email OK, except for the timestamp:

with smtplib.SMTP_SSL(smtp_server, port, context=context) as server:
    server.login(sender_email, password)
    for e in email_address(customer_emails):
        print(f'email is {e} ')
        server.sendmail(sender_email, e, message)
        print(f'email sent to {r}')
I don't know why the timestamp is 1970!
Reply


Messages In This Thread
smtplib send email has no timestamp - by Pedroski55 - Jun-10-2024, 07:17 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Send email with smtp without using Mimetext mgallotti 0 805 Feb-01-2023, 04:43 AM
Last Post: mgallotti
  email Library: properly send message as quoted-printable malonn 3 1,547 Nov-14-2022, 09:31 PM
Last Post: malonn
  Unable to send email attachments cosmarchy 7 2,890 Mar-09-2022, 09:29 PM
Last Post: bowlofred
  How to make scraper send email notification just once themech25 0 1,476 Nov-08-2021, 01:51 PM
Last Post: themech25
  Sending Attachments via smtplib [SOLVED] AlphaInc 3 2,327 Oct-28-2021, 12:39 PM
Last Post: AlphaInc
  Sending random images via smtplib [SOLVED] AlphaInc 0 1,772 Oct-19-2021, 10:10 AM
Last Post: AlphaInc
  [UnicodeEncodeError from smtplib] yoohooos 0 3,537 Sep-25-2021, 04:27 AM
Last Post: yoohooos
  send email smtp rwahdan 0 1,883 Jun-19-2021, 01:28 AM
Last Post: rwahdan
  Need Outlook send email code using python srikanthpython 3 8,649 Feb-28-2021, 01:53 PM
Last Post: asyswow64
  Understanding The Arguments for SMTPlib - sendmail JoeDainton123 3 2,869 Aug-03-2020, 08:34 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020