Hi Paul, Paul E Condon wrote: > I have been cleaning up old email files and in the process created a > mess I have several mail directories containing emails from different > times and collected under slightly different operating condition. I > want to merge them into a single directory with the emails arranged in > threads by topic and in chronological order.
You say you use mutt. Is there anything wrong with visiting the mailboxes one by one with mutt and then using mutt to save the messages to your desired location? In mutt: T tag messages matches a pattern ~A Pattern is ALL messages in mailbox ; tag prefix, next command works on tagged messages S save all taggged messages to the specified folder > I have procmail configured to deliver email to several mbox format > files, all in a directory whose name is ~/mail. I have about 60 > delivery mbox files in ~/mail. Procmail also runs bogofilter for > spam suppression. If you need to do this to all 60 of those mailboxes I could see it being tedious. But if you are simply cleaning and have a dozen to do then it might be easiest to do them manually. > From my investigations of other email arrangements I have accumulated > other directories of email folders, mostly in mbox format, but also > one in Maildir format. All these other email directories are also in Mutt can read all of those formats. > my home directory (of course with different names ;). I want help to > devise some command line that will read emails from one of these old > directories and move copies into my current email directory. I think To make a copy in mutt instead of S for Save use C for Copy. But in my experience making copies of mail often means more confusion. Easier to have a single copy rather than forking a copy. > this can be done starting with cat and using formail and ending with > procmail, but I'm getting a lot of emails that purport to come from > foo@bar , which I know is because I've some formail options wrong. > Here is an example of things I've tried: > > cat mail-20140812_004037/* | formail +1 -tzeds procmail Are those mbox files? The "cat directory/*" isn't putting in the needed mbox "From " header mail separator line. That will break some of the messages. > I've renamed all the old email directories to contain a timestamp > extension. The above shows one of them. I don't really understand +1, > but a lot of email magic seems to have it. I'm hoping that this will That +1 is used for splitting / bursting open a mailing list digest message. As was just discussed a few days ago most people don't know how to deal with mailing list digest messages very well. But formail is one of the tools that can be used to take a digest message and split it apart into individual messages. The +1 skips the digest boilerplate part of the collection which is usually the first message. If you aren't dealing with digests then you probably don't want it. If you use it on other collections then it will skip the first message and those skipped messages won't be processed. > feed the emails to procmail and it will process them as if they were > coming from fetchmail, which I know works for currently arriving > email. I know that many of the emails don't have a envelope From line, > but I don't know how to get formail to pick out a string that can be > made into a functional From line. My understanding is that the > envelope From line is only used in routeing the email throug the > internet and once it arrives at a destination the data in it is > ignored in deference to the actual headers that contain a colon, and The "From " is usually generated from the envelope header. But for mbox format files that "From " line is the message separator too. > the text of the body. So, I guess I'm looking for a way to get emails > that have missing parts to appear to be whole to formail and procmail. > Only I don't really know what they look for or why. Suggestions? If it is less than a dozen then I would use mutt to read the mailbox source and then save those to the destination you want. Just use brute force to do it and then it will be done. Because brute force usually triumps over elegance and finesse. :-) Bob
signature.asc
Description: Digital signature