12

I would like to add a unique RFC2822 compliant Message-ID header to a message created using Python's built in email library. How would I got about doing this? Is there a way within the library itself?

Community
  • 1
  • 1
TIMEX
  • 259,804
  • 351
  • 777
  • 1,080
  • 1
    This should never have been closed as off-topic. It was perfectly clear exactly what the question was. The request for a library recommendation could've easily been edited out or ignored, especially since the answer is in the Python standard library itself. – Omnifarious Jun 08 '18 at 17:50

1 Answers1

16

This might help:

from email.utils import make_msgid 
make_msgid()

This is described here:

https://docs.python.org/2/library/email.utils.html#email.utils.make_msgid

https://docs.python.org/3/library/email.utils.html#email.utils.make_msgid

Lex Scarisbrick
  • 1,540
  • 1
  • 24
  • 31