I second the motion for Majordomo. It is quite possibly one of the most widely used Perl programs on the Net, and has been in use for nearly a decade. It is the first package many system administrators think of when they think "Opt-in mailing list." As mentioned before, it isn't really designed for tens of thousands of subscribers, but it is well suited for hundreds or thousands.
You may read more about it at http://www.greatcircle.com/majordomo/. That site also contains links to its source code (Perl, of course). If I recall, Majordomo was already in use back in the days of Gopher, Archie, Jughead, and a new-fangled thing called the World Wide Web (early days).
Dave
"If I had my life to live over again, I'd be a plumber." -- Albert Einstein