Mutt error: "folder" is not a mailbox

While developing a script I hit this error. It was a strange one, in my opinion. I didn't know a lot about mutt and mail clients/servers in linux, so I was thinking "Why the hell a folder is not a valid mailbox????"

/home/bigbrus_corner/sent is not a mailbox. Why?? 
Probably the right question is instead "What is a Mailbox then?"

QUICK ANSWER
Mutt needs all mailbox to be files. So, you simply have to change in your muttrc configuration file (default is something like /home/user/.muttrc ) the guilty field from directory to file.

In my situation it was:

set record = "/home/bigbrus_corner/sent/"

which became simply (notice the missing / at the end):

set record = "/home/bigbrus_corner/sent"

but there are other possible fields, according to your mutt configuration.

Keep always in mind you luck. The error above (which requires a little more knwoledge on how mutt works to be helpful) appears only if you already created the directory. If the directory doesn't exist, you receive the error below:

/home/bigbrus_corner/sent_nonexistent/: Is a directory (errno=21) . Apart from the error number, this is an error I can easily correct and understand!!!

which states directly that you are using a directory and that it is an error. From which you can deduce that you probably need a file, which in my case was the useful information.

LONG ANSWER
Mutt, like many other mail clients (but anyway according to his configuration) writes all mails he manages in single files, possibly divided into mailbox (you know, Incoming, Sent, and similar).
The structure of those files is quite simple: the complete MIME message (Multipurpose Internet Mail Extension - which is the text message you actually send and has a lot more information than what you usually see), then a blank line, then another MIME message, then another blank line, and so on. Mails are simply concatenated keeping their original format.

This is, with some nice colors, what a MIME message looks like.

What's peculiar about this, it's that while Internet is a place of standards (and maybe there are too many of them), one thing that was never standardized with an "official" RFC is the format in which mails should be stored. It was left to developers of mail clients to define a format. I like to think that mutt (and other clients) developers were overdue with work and for once they could keep things VERY simple, so they basically used an append command ;)

USEFUL LINKS

RELATED POSTS

Labels: ,