MailGrab - A Command-Line POP3 Client

A number of people were asking if I had a counterpart for MailSend that would allow them to read mail via a command-line. I had thought about such a utility, but the practice of reading email differs from that of sending mail. It’s easy to envision text and or files that are produced by some sort of process that can be then send out via SMTP, but what would the automation of processing inbound email look like? Was it something that I could even capture in a command-line tool?

The POP3 protocol itself is pretty simple. The complicated parts are the layered types of encoding that can appear in the mail headers and payload. Emailers were beginning to send email in two forms: plain old text and HTML. The headers that appeared before each in the POP3 data stream enabled mail clients to read and display either, presumably depending on some choice that the end user has made. Other data types were also possible depending on MIME ( Minimal Internet Mail Extensions ) encoding. MIME also allowed for base64-encoded attachments. There were other sigils that could appear in text that were mean to begin escape sequences for embedded control codes in the body of the emails.

I built a simple POP3 client called MailGrab. I also built it in TAWK. Why mess with a good thing? I used my own inbound emails as test candidates for the tool and I learned a lot. One of the things I learned was that some email clients (or perhaps the servers) were broken. They produced emails which did not have fully encoded blocks. So, my little emailer handled a number of these edge cases where the incoming email was somewhat mangled.

MailGrab had only a few options. It could retrieve a full POP3 payload or it could retrieve those sections that did not appear to be attachments. It could delete the emails once downloaded, or it could leave them fully intact. With a simple set of functions such as these, I made MailGrab available via the shareware method, again. It did well enough. There were fewer competitors to MailGrab back then.

It won a ZDNet “Editor’s Pick” award (4 stars). I proudly displayed the award graphic on this very site:

People were using combinations of MailSend and MailGrab to perform all sorts of mail automation tasks. One person wrote an email client in Microsoft’s QBASIC interpreter that invoked MailSend and MailGrab to manage the actual email send / receive functions. This was a unique trait about 32-bit command-line software: it could be invoked from a 16-bit program. My tools were used by a number of people who were using some older 16-bit tools such as the Clipper xBase compiler. One of my clients purchased a reseller’s license to each tool because their main product was written in a specialty database language (not unlike Clipper) and they needed to offer their clients email functionality from within the app.

While I really enjoyed interacting with the folks who were using the software, it became too difficult for me to support. I don’t think I had really built it correctly and each time a new upgrade of a given mail server came out, I found myself trying to figure out why MailGrab wasn’t parsing the emails correctly. It was usually my fault. After one particularly grueling fix to the software, I made the choice to quit selling MailSend. I kept supporting my existing customers for a while, but I was no longer permitting active sales.

Although I toy with the idea of writing more POP3 (and or IMAP) mail automation tools, I haven’t implemented anything else in that genre of software, yet.