TIP: Click on subject to list as thread! ANSI
echo: jamnntpd
to: ALL
from: MATT BEDYNEK
date: 2015-07-04 20:47:00
subject: Python script to read ech

All,

Realize there may be similar things out there but this is what I wrote.  It
assumes your message base file name is the same as your echo tag. It is
embedded in my processing logic.   It will create a unique list of output
echoes to scan.

The python may not be elegant but I have only been writing python for less than
a week.  If you have suggestions please provide them!


-----8<-------

#!/usr/local/bin/python

import re
import os

echomailJam = '/opt/ftn/mail/echomail.jam'
echotossLog = '/opt/ftn/mail/echotoss.log'

try:
        fp = open(echomailJam, "rb")
        echoes = []
        for line in fp:
                msgbase = re.match(r'.*/(\S+)\s+\d+',line.rstrip())
                if msgbase.group(1) not in echoes:
                        echoes.append(msgbase.group(1))
except:
        print ("unable to read: " + echomailJam)
finally:
        fp.close()


try:
        fp = open(echotossLog, "ab")
        for tag in echoes:
                fp.write(tag + "\n")
except:
        print ("unable to write: " + echotossLog)
finally:
        fp.close()
        os.remove(echomailJam) if os.path.exists(echomailJam) else None

--- Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.
* Origin: *** nntp://rbb.bbs.fi *** Lake Ylo *** Finland *** (2:221/361)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.