pythonemailheaderrfc2822

How do I create a message-id for email in python?


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?


Solution

  • 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