Last active
October 8, 2019 10:20
-
-
Save erlingpaulsen/0dffa2c2e2a0fb1d05219a3aea1dcd87 to your computer and use it in GitHub Desktop.
Seeded thread index generator for grouping Microsoft Outlook emails into converations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import uuid | |
import random | |
import base64 | |
def generateThreadIndex(seed): | |
# Generates a Microsoft Outlook thread index based on a seed. | |
# Add the thread index with the 'Thread-Index' header when sending an email to group the emails into conversations | |
rd = random.Random() | |
rd.seed(seed) | |
threaduuid = uuid.UUID(int=rd.getrandbits(128)) | |
return base64.standard_b64encode('\x01\x00\x00\x12\x34\x56' + threaduuid.get_bytes()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment