4 Comments

  1. anonymous

    You should also always add the date header. It is required accoring to RFC 822 and messages without it might have an increased spam rating. I suggest the following solution for doing so:

    msg[“Date”] = email.Utils.formatdate(localtime=True)

    • I was relying on sendmail to add that header, but it’s still a good point to add it ourselves. A different MTA may not behave the same way.

      I’ve updated the body of the post accordingly, and also updated the attached .py file.

Leave a Reply

Your email address will not be published. Required fields are marked *