MCPcopy Index your code
hub / github.com/python/cpython / make_msgid

Function make_msgid

Lib/email/utils.py:287–312  ·  view source on GitHub ↗

Returns a string suitable for RFC 2822 compliant Message-ID, e.g: <142480216486.20800.16526388040877946887@nightshade.la.mastaler.com> Optional idstring if given is a string used to strengthen the uniqueness of the message id. Optional domain if given provides the portion of the m

(idstring=None, domain=None)

Source from the content-addressed store, hash-verified

285
286
287def make_msgid(idstring=None, domain=None):
288 """Returns a string suitable for RFC 2822 compliant Message-ID, e.g:
289
290 <142480216486.20800.16526388040877946887@nightshade.la.mastaler.com>
291
292 Optional idstring if given is a string used to strengthen the
293 uniqueness of the message id. Optional domain if given provides the
294 portion of the message id after the '@'. It defaults to the locally
295 defined hostname.
296 """
297 # Lazy imports to speedup module import time
298 # (no other functions in email.utils need these modules)
299 import random
300 import socket
301
302 timeval = int(time.time()*100)
303 pid = os.getpid()
304 randint = random.getrandbits(64)
305 if idstring is None:
306 idstring = ''
307 else:
308 idstring = '.' + idstring
309 if domain is None:
310 domain = socket.getfqdn()
311 msgid = '<%d.%d.%d%s@%s>' % (timeval, pid, randint, idstring, domain)
312 return msgid
313
314
315def parsedate_to_datetime(data):

Callers 2

runMethod · 0.85

Calls 2

timeMethod · 0.45
getrandbitsMethod · 0.45

Tested by 1

runMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…