meillo@39: .RN 1 meillo@197: .H0 "Introduction meillo@197: .Id introduction meillo@39: meillo@0: .P meillo@227: MH is a set of mail handling tools with a common concept. meillo@227: It is similar to the Unix tool chest, which is a set of file meillo@227: handling tools with a common concept. meillo@227: \fInmh\fP is the currently most popular implementation of an meillo@53: MH-like mail handling system. meillo@53: This thesis describes an experimental version of nmh, named \fImmh\fP. meillo@53: .P meillo@32: This chapter introduces MH, its history, concepts and how it is used. meillo@47: It describes nmh's code base and community to give the reader meillo@227: a better understanding of the project's condition at the time when meillo@227: mmh started off. meillo@181: Furthermore, this chapter outlines the mmh project itself, meillo@47: describing the motivation for it and its goals. meillo@8: meillo@0: meillo@28: .H1 "MH \(en the Mail Handler meillo@197: .Id mh meillo@0: .P meillo@47: MH is a conceptual email system design and its concrete implementation. meillo@212: MH had started as a design proposal at RAND Corporation, meillo@47: where the first implementation followed later. meillo@47: In spirit, MH is similar to Unix, which meillo@42: influenced the world more in being a set of system design concepts meillo@32: than in being a specific software product. meillo@47: The ideas behind Unix are summarized in the \fIUnix philosophy\fP. meillo@207: .[ meillo@207: gancarz unix philosophy meillo@207: .] meillo@42: MH follows this philosophy. meillo@2: meillo@11: .U2 "History meillo@2: .P meillo@32: In 1977 at RAND Corporation, Norman Shapiro and Stockton Gaines meillo@209: proposed the design of a new mail handling system, meillo@207: .[ meillo@207: shapiro gaines mh proposal meillo@207: .] meillo@209: to superseed RAND's old monolithic \fIMail System\fP (MS). meillo@212: One year later, in 1978, Bruce Borden picked up on the meillo@209: proposal and implemented a prototype, which he called meillo@209: \fIMail Handler\fP (MH). meillo@106: Before the prototype's existence, the concept was meillo@47: believed to be practically unusable. meillo@209: But the prototype \(en written in only three weeks \(en meillo@212: proved successful and replaced MS thereafter.\& meillo@209: .[ [ meillo@209: rand note design of mh meillo@209: .], p. 4] meillo@2: .P meillo@106: In the early eighties, meillo@106: the University of California at Irvine (UCI) started to use MH. meillo@106: Marshall T. Rose and John L. Romine then became the driving force. meillo@57: They took over the development and pushed MH forward. meillo@209: .[ [ meillo@209: rand note design of mh meillo@209: .], p. 4] meillo@57: RAND had put the code into the public domain by then. meillo@212: MH was developed at UCI at the same time when the Internet appeared, meillo@212: BSD started to support TCP/IP networking, meillo@209: and Eric Allman wrote Sendmail. meillo@47: MH was extended as emailing became more featured. meillo@209: The development of MH was closely related to the development of email RFCs. meillo@204: In the advent of the \fIMultipurpose Internet Mail Extensions\fP (MIME), meillo@204: MH was one of the first implementations of the new email standard. meillo@2: .P meillo@117: In the nineties, the Internet became popular and in December 1996, meillo@181: Richard Coleman initiated the \fINew Mail Handler\fP (nmh) project. meillo@212: Nmh is a fork of MH 6.8.3 and bases heavily on the meillo@47: \fILBL changes\fP by Van Jacobson, Mike Karels and Craig Leres. meillo@207: .[ meillo@207: lbl changes meillo@207: .] meillo@32: Colman intended to modernize MH and improve its portability and meillo@32: MIME handling capabilities. meillo@47: The development of MH at UCI stopped after the 6.8.4 release in meillo@47: February 1996, soon after the development of nmh had started. meillo@212: Today, nmh is developed openly in the Internet community. meillo@212: It has almost completely replaced the original MH. meillo@212: Some systems might still provide the old MH, but hardly for good reasons. meillo@47: .P meillo@212: In the last years, the majority of changes in nmh was maintenance work. meillo@212: Nevertheless, the development was revived in December 2011 meillo@57: and stayed busy since then. meillo@0: meillo@197: meillo@11: .U2 "Concepts meillo@0: .P meillo@53: MH consists of a set of tools, each covering a specific task of meillo@209: email handling, such as composing a message, replying to a message, meillo@53: refiling a message to a different folder, listing the messages in a folder. meillo@209: The tools are invoked directly from the Unix shell. meillo@209: .[ meillo@209: a rand note design of mh meillo@209: .] meillo@42: .P meillo@209: The tools operate on a common mail storage, which consists of meillo@209: \fImail folders\fP (directories) and \fPmessages\fP (regular files). meillo@209: Each message is stored in a separate file. meillo@209: .[ meillo@209: a rand note design of mh meillo@209: .] meillo@47: The files are named with ascending numbers in each folder. meillo@47: The specific format of the mail storage characterizes MH in the same way meillo@106: as the format of the file system characterizes Unix. meillo@42: .P meillo@164: MH tools maintain a \fIcontext\fP, which includes for instance the meillo@164: current mail folder. meillo@32: Processes in Unix have a similar context, containing the current working meillo@32: directory, for instance. In contrast, the process context is maintained meillo@32: by the Unix kernel automatically, whereas MH tools need to maintain the MH meillo@32: context themselves. meillo@106: The user can have one MH context or multiple ones; he can even share it meillo@106: with others. meillo@42: .P meillo@164: Messages are named by their numeric filename, meillo@207: but they can have symbolic names, as well. meillo@207: These are either one of six system-controlled position names meillo@208: and a shorthand for the range of all messages, meillo@32: or user-settable group names for arbitrary sets of messages. meillo@32: These names are called sequences. meillo@207: Automatically updated position names exist for the meillo@208: first, last, previous, next, current message, and for the number meillo@208: one beyond the last message. meillo@207: (In mmh, the names of these sequences are abbreviated to the meillo@207: first character.) meillo@207: User-definded sequences can be bound to the folder containing the meillo@207: messages (\fIpublic sequences\fP) or to the user's context meillo@207: (\fIprivate sequences\fP). meillo@2: .P meillo@207: The user's \fIprofile\fP is the file that contains his MH configuration. meillo@47: Default switches for the individual tools can be specified to meillo@47: adjust them to the user's personal preferences. meillo@207: These switches will be automatically supplied whenever the specific meillo@207: tool is invoked. meillo@164: Additionally, a single command can be linked under different names meillo@207: with different default values. meillo@207: Form templates for new messages and replies, as well as format files meillo@207: to adjust the output of tools are easily exchanged in the profile. meillo@212: Almost every part of the system can be adjusted to personal preference. meillo@42: .P meillo@212: The whole system is well scriptable and extensible. meillo@207: New MH tools are built out of or on top of existing ones quickly. meillo@212: MH encourages the user to tailor, extend, and automate the system. meillo@207: As the MH tool chest was modeled after the Unix tool chest, the meillo@207: properties of the latter apply to the former as well. meillo@102: meillo@102: meillo@102: meillo@54: .U2 "Using MH meillo@53: .P meillo@209: Many tutorials to using MH meillo@209: .[ meillo@209: rose sweet mh tutorial meillo@209: .] meillo@209: .[ meillo@209: moss jackson user's guide for mh meillo@209: .] meillo@209: .[ meillo@209: hegardt mh for beginners meillo@209: .] meillo@212: are old, but still they teach the concepts and basics, meillo@212: which remained unchanged. meillo@212: Rose and Romine have written an excellent introduction on a more meillo@212: technical level, with pointers to advanced usage. meillo@209: .[ meillo@209: rose romine real work meillo@209: .] meillo@212: For a more recent document, it is strongly recommended to have meillo@212: a look at the \fIMH Book\fP, meillo@54: .[ [ meillo@54: peek mh book meillo@54: .], Part II] meillo@212: especially at its online version. meillo@27: .P meillo@212: Following here is a sample mail handling session with mmh. meillo@212: Details might vary to MH and nmh but the look and feel is the same. meillo@82: meillo@202: .so input/mh-session meillo@27: meillo@27: meillo@131: .H1 "nmh meillo@2: .P meillo@49: In order to understand the condition, goals and dynamics of a project, meillo@106: one needs to know the reasons behind them. meillo@212: This section gives background information. meillo@53: .P meillo@197: MH predates the Internet; meillo@212: it comes from times before networking was universal; meillo@49: it comes from times when emailing was small, short and simple. meillo@212: Then, MH grew, spread and adapted to the changes email went through. meillo@212: Its core concepts, however, remained the same. meillo@106: During the eighties, students at UCI actively worked on MH. meillo@164: They added new features and optimized the code for the systems meillo@164: popular at that time. meillo@212: This was in times before POSIX and ANSI C. meillo@49: As large parts of the code stem from this time, today's nmh source code meillo@49: still contains many ancient parts. meillo@51: BSD-specific code and constructs tailored for hardware of that time meillo@49: are frequent. meillo@2: .P meillo@212: Nmh started about one decade after the POSIX and ANSI C standards were meillo@212: released. meillo@212: A more modern coding style entered the code base but still meillo@212: a part of the developers were ``of the old type''. meillo@212: The developer base became more diverse, meillo@212: thus broadening the range of different coding styles. meillo@49: Programming practices from different decades merged in the project. meillo@51: As several peers added code, the system became more a conglomeration meillo@51: of single tools rather than a homogeneous of-one-cast mail system. meillo@212: For that, leadership would have been necessary. meillo@212: Nevertheless, MH's basic concepts held the project together. meillo@8: They were mostly untouched throughout the years. meillo@8: .P meillo@212: Though clearly separated on the surface meillo@212: \(en as a collection of small, separate programs \(en meillo@212: the source code turns out to be fairly interwoven. meillo@212: Multiple separate components are compiled into a program meillo@51: for efficiency reasons. meillo@212: This leads to intricate innards. meillo@8: .P meillo@212: It is visible in nmh that meillo@212: the advent of MIME raised the complexity of email by a magnitude. meillo@212: The MIME-related parts are the most complex ones. meillo@106: It is also visible that MIME support was added on top of the old MH core. meillo@51: MH's tool chest style made this easily possible and encourages meillo@106: such approaches, but unfortunately, it led to duplicated functions meillo@212: and half-hearted implementation of concepts. meillo@49: .P meillo@212: To provide backward-compatibility, it is a common understanding meillo@212: in the nmh community to not change the default settings. meillo@212: In consequence, users need to activate modern features explicitly meillo@47: to be able to use them. meillo@212: The ancient style in which fresh nmh setups remain to appear meillo@212: causes difficulties for new users, as modern email features require meillo@212: additional configuration. meillo@212: The small but mature community around nmh, however, needs little change meillo@106: as they have had their convenient setups for decades. meillo@8: meillo@8: meillo@27: .H1 "mmh meillo@28: .P meillo@49: I started to work on my experimental version in October 2011, meillo@197: basing my work on nmh version \fInmh-1.3-dev\fP. meillo@197: At that time no more than three commits were made to nmh meillo@212: since the beginning of 2011, the latest one being meillo@212: .Ci a01a41d031c796b526329a4170eb23f0ac93b949 , meillo@212: commited on 2011-04-13. meillo@53: In December, when I announced my work in progress on the meillo@53: nmh-workers mailing list, meillo@42: .[ meillo@51: nmh-workers mmh announce December meillo@42: .] meillo@197: nmh's community became active, all of a sudden. meillo@49: This movement was heavily pushed by Paul Vixie's ``edginess'' comment. meillo@42: .[ meillo@42: nmh-workers vixie edginess meillo@42: .] meillo@53: After long years of stagnation, nmh became actively developed again. meillo@197: Hence, while I was working on mmh, the community was working on nmh, meillo@212: in parallel but unrelated. meillo@28: .P meillo@53: The name \fImmh\fP may stand for \fImodern mail handler\fP, meillo@53: because the project tries to modernize nmh. meillo@53: Personally however, I prefer to call mmh \fImeillo's mail handler\fP, meillo@207: emphasizing that the project is my version of nmh, meillo@207: following my visions and preferences. meillo@42: (My login name is \fImeillo\fP.) meillo@53: This project model was inspired by \fIdwm\fP, meillo@42: which is Anselm Garbe's personal window manager \(en meillo@42: targeted to satisfy Garbe's personal needs whenever conflicts appear. meillo@227: Dwm has retained its lean elegance and its focused character, meillo@227: .[ meillo@227: dwm ohloh meillo@227: .] meillo@227: whereas its community-driven predecessor \fIwmii\fP had grown meillo@227: fat over time. meillo@227: .[ meillo@227: wmii ohloh meillo@227: .] meillo@53: The development of mmh should remain focused. meillo@27: meillo@45: meillo@27: .U2 "Motivation meillo@27: .P meillo@207: MH is the most important of very few email systems in a tool chest style. meillo@51: Tool chests are powerful because they can be perfectly automated and meillo@212: extended. meillo@212: They allow the implementation of arbitrary kinds of front-ends meillo@212: on top of the tool chest quickly and without internal knowledge. meillo@106: Additionally, tool chests are easier to maintain than monolithic meillo@43: programs. meillo@227: .[ [ meillo@227: gancarz unix phil meillo@227: .], p. 14] meillo@212: MH-like email tool chests should be kept alive as they fill a market meillo@212: niche by providing conceptional elegance and unique scripting qualities. meillo@212: Mmh tries to create a modern and convenient entry point to MH-like meillo@212: systems for new and interested users. meillo@43: .P meillo@51: The mmh project is motivated by deficits of nmh and meillo@212: by my wish for general changes. meillo@212: At the time the mmh project started, nmh had not yet adjusted to meillo@212: modern emailing needs well enough. meillo@45: The default setup was completely unusable for modern emailing. meillo@45: Too much setup work was required. meillo@212: Several modern features were already available, meillo@212: but the community did not want to have them active by default. meillo@212: Mmh is my way to change this. meillo@45: .P meillo@212: In my eyes, MH's concepts could be exploited better and meillo@212: the style of the tools could be improved. meillo@212: Both would simplify and generalize the system, providing cleaner meillo@212: interfaces and greater software leverage at the same time. meillo@212: Mmh is my way to demonstrate this. meillo@45: .P meillo@212: In providing multiple parts of the email system, nmh can hardly meillo@45: compete with the large specialized projects that focus meillo@212: on one of the components only. meillo@212: The situation could be improved by concentrating the development power meillo@51: on the most unique part of MH and letting the user pick his preferred meillo@45: set of other mail components. meillo@45: Today's pre-packaged software components encourage this model. meillo@212: Mmh is my way to provide this. meillo@45: .P meillo@197: It is worthwhile to fork nmh for the development of mmh, meillo@197: because the two projects focus on different goals and differ in meillo@197: fundamental questions. meillo@106: The nmh community's reluctance regarding change conflicts meillo@106: with my strong desire for it. meillo@207: .[ meillo@207: nmh-workers schnalke understanding nmh meillo@207: .] meillo@212: In developing a separate experimental version, new approaches can meillo@43: easily be tried out without the need to discuss changes beforehand. meillo@43: In fact, revolutionary changes are hardly possible otherwise. meillo@43: .P meillo@117: The mmh project provides the basis on which the aforementioned meillo@117: ideas can be implemented and demonstrated, meillo@164: without the need to change the nmh project or its community. meillo@43: Of course, the results of the mmh project shall improve nmh, in the end. meillo@159: By no means it is my intent to work against the nmh project. meillo@117: meillo@27: meillo@27: .U2 "Target Field meillo@27: .P meillo@45: Any effort needs to be targeted towards a specific goal meillo@45: in order to be successful. meillo@197: Therefore, a description of an imagined typical mmh user follows. meillo@212: Actually, as mmh is my personal version of MH, meillo@212: this is sort of a description of myself. meillo@212: Developing software for one's own is a reliable way to produce software meillo@197: that matches the user's desires. meillo@45: .P meillo@197: The target user of mmh likes Unix and its philosophy. meillo@197: He appreciates to use programs that are conceptionally appealing. meillo@197: He is familiar with the command line and enjoys its power. meillo@197: He is capable of shell scripting and wants to improve his meillo@27: productivity by scripting the mail system. meillo@197: He uses modern email features, such as attachments, meillo@169: non-ASCII text, digital signatures and message encryption in a natural way. meillo@212: He is able to set up mail system components meillo@212: and likes to pick the ones he prefers. meillo@197: He has a reasonably modern operating system that complies to the meillo@164: POSIX and ANSI C standards. meillo@27: .P meillo@197: The typical user invokes mmh commands directly in an interactive meillo@212: shell session, even on workstations where graphical front-ends could meillo@212: be added. meillo@197: Likely, he runs his mail setup on a server machine, meillo@197: to which he connects via ssh. meillo@212: He might automate mail processing with mmh tools meillo@212: but definitely he uses the tools to build better tools. meillo@212: In any case, he wants to have the flexibility to change meillo@197: his setup to suit his needs. meillo@8: .P meillo@197: The typical mmh user is a programmer. meillo@212: He likes to, occasionally, make use of the opportunity of free software meillo@212: by putting hands on and getting involved in software he uses. meillo@197: In consequence, he likes small and clean code bases and cares for meillo@197: code quality. meillo@197: In general, he believes that: meillo@8: .BU meillo@197: The elegance of source code is most important. meillo@8: .BU meillo@197: Concepts are more important than concrete implementations. meillo@8: .BU meillo@197: Code optimizations for anything but readability should be avoided. meillo@8: .BU meillo@212: Removed code is debugged code. meillo@212: .BU meillo@45: Having a lot of choice is bad. meillo@8: meillo@197: meillo@212: .U2 "Goals of the mmh Project meillo@128: .IP "Streamlining meillo@87: Mmh should be stripped down to its core, which is the user agent (MUA). meillo@117: The feature set should be distilled to the indispensable ones, meillo@171: effectively removing corner cases. meillo@173: Parts that do not add to the main task of being a conceptionally meillo@187: appealing user agent should be removed. meillo@212: This includes the mail transfer and mail retrieval facilities. meillo@48: Choice should be reduced to the main options. meillo@131: All tools should be tightly shaped. meillo@48: .IP "Modernizing meillo@48: Mmh's feature set needs to become more modern. meillo@212: Better support for attachments, digital signatures, and message meillo@212: encryption should be added. meillo@159: MIME support should be integrated deeper and more naturally. meillo@48: The modern email features need to be readily available, out-of-the-box. meillo@212: On the other hand, obsolete facilities can be dropped out and meillo@212: ancient technologies need not be further supported. meillo@212: The available concepts should be expanded as far as possible. meillo@131: A small set of concepts should recur consistently. meillo@131: .IP "Styling meillo@212: Mmh's source code should be updated to modern standards. meillo@48: Standardized library functions should replace non-standard versions meillo@48: whenever possible. meillo@117: Code should be separated into distinct modules when feasible. meillo@48: Time and space optimizations should to be replaced by meillo@48: clear and readable code. meillo@48: A uniform programming style should prevail. meillo@117: The whole system should appear to be of-one-style; meillo@117: it should feel like being cast as one.