1

(69 replies, posted in News)

Tobi wrote:

I don't know your recipien lists.
If they are random you should definitely consider sorting the addresses by domains.

python solution for presorting mailing lists (quick hack):

#!/usr/bin/env python
# encoding: utf-8

# sort email adresses by domain
# Karsten W. Rohrbach <alpha@webmonster.de>

import sys

def swappy(input):
    output = []
    for el in input:
        try:
            one,two = el.split('@')
            output.append('@'.join([two,one]))
        except Exception:
            output.append(input)
    return output

try:
    f = open(sys.argv[1], 'r')
    outfile = open(sys.argv[2], 'w')
except Exception, e:
    print "syntax:", sys.argv[0], "<infile> <outfile>"
    sys.exit(99)
adx = []
adx = f.readlines()
f.close()

ad2 = swappy(adx)
del adx
ad2.sort()
ad3 = swappy(ad2)
del ad2
outfile.write(''.join(ad3))
outfile.close()

This is a quick hack and needs a bit more than 2 times the RAM of your mailing list size.
Works for me, anyway ;-)

Regards,
/k