Skip to content

Instantly share code, notes, and snippets.

@erlingpaulsen
Last active October 8, 2019 10:20
Show Gist options
  • Save erlingpaulsen/0dffa2c2e2a0fb1d05219a3aea1dcd87 to your computer and use it in GitHub Desktop.
Save erlingpaulsen/0dffa2c2e2a0fb1d05219a3aea1dcd87 to your computer and use it in GitHub Desktop.
Seeded thread index generator for grouping Microsoft Outlook emails into converations
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