I’m looking for a tool that can take sendmail mailing lists (that is, text files that can be the target of :include: directives in the aliases file) and parse them to generate a list of recipients. The files could, of course, contain comments, recipients with “descriptive” names in addition to actual addresses, a mixture of external addresses and local users and other aliases, etc.
Does there exist either a tool to do this parsing, or a formal specification that would allow me to write one myself? Or will I have to write an ad-hoc one which is nearly certain to contain bugs?
I don’t have root access to the server I’m working on, so sendmail -bv doesn’t work. (Of course, I could always set up my own installation if I just needed to use it as a utility independent of the actual setup.) sendmail -bt does appear to work, but I’m not entirely sure how to use it.
Here is the Python code that I ultimately used to solve this problem. You would have to tweak it to work on a server configured differently from mine.