summaryrefslogtreecommitdiffstats
path: root/Demo/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'Demo/scripts')
-rwxr-xr-xDemo/scripts/mboxconvert.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Demo/scripts/mboxconvert.py b/Demo/scripts/mboxconvert.py
index ff7ca6a..ecd6965 100755
--- a/Demo/scripts/mboxconvert.py
+++ b/Demo/scripts/mboxconvert.py
@@ -76,6 +76,8 @@ def mmdf(f):
'Bad line in MMFD mailbox: %s\n' % `line`)
return sts
+counter = 0 # for generating unique Message-ID headers
+
def message(f, delimiter = ''):
sts = 0
# Parse RFC822 header
@@ -93,6 +95,14 @@ def message(f, delimiter = ''):
# Copy RFC822 header
for line in m.headers:
print line,
+ # Invent Message-ID header if none is present
+ if not m.has_key('message-id'):
+ global counter
+ counter = counter + 1
+ msgid = "<%s.%d>" % (hex(t), counter)
+ sys.stderr.write("Adding Message-ID %s (From %s)\n" %
+ (msgid, email))
+ print "Message-ID:", msgid
print
# Copy body
while 1: