On 16Oct2020 08:35, Ranjan Maitra <maitra@xxxxxxxxx> wrote: >> >This may be a stupid question, but does this problem still happen if I use fetchmail to pull mail and store messages in files via procmail? >> >> Well, it is an issue regardless of the tool. procmail may do the initial >> placement, but your mail reader probably moves messages around, if only >> from one folder to another, which is the same task (new message in >> target folder). > >I see, yes, that is possible, but I have not seen this problem for me. Perhaps the way I have (inadvertently) used it so far may be the reason, or I have been plain fortuitous. As long as they share an agreed locking protocol it can all be fine. >> >Thanks very much for this. I have found a tool that can convert mh to mailbox: >> > >> >https://github.com/vuntz/mh2maildir/blob/master/mh2maildir >> > >> >It seems to work, but can not handle a second level of subfolders: brings them all out as individual folders at the first level, so Ihave to fix that. Also, I don't like the new folder names, seem too unnecessary for me. (I was expecting to the old MH folder names inside my Maildir.) Also, the mails get stored as something like: 1602799622.116065_21187.hostname:2, not sure if this is the recommended way that files are stored in the Maildir format. I was expecting to have something that I could have control over. >> >> Yah. I wrote one when I made this switch: >> >> https://hg.sr.ht/~cameron-simpson/css/browse/bin/mh2maildir?rev=tip >> >> Hmm, some years ago now, looking at the opening comment. And I'm using >> procmail for the conversion (!!!), so indeed quite a while ago. This >> script moves the MH folder sideways and makes an empty Maildir in its >> place, then delivers every message from the MH folder into the new >> maildir. > >Thanks very much for this! I will try it out, but it appears to be for individual folders, is that correct? So, I will maybe write a script to call it. Yes. I just wrote a for loop on the command line. Something like: cd ~/mail for mhdir in [a-z]*; do (set -x; mh2maildir "$mhdir") || break; done because I feared disaster. Easy as. >> These days I'd use mutt for the bulk conversion instead of procmail. You can >> see an example of that approach in this script: >> >> https://hg.sr.ht/~cameron-simpson/css/browse/bin/mboxify?rev=tip > >I see, this is for converting to mbox and needs to be modified for Yep. But the conversion is pretty trivial. Mutt autodetects the folder type. If a file, mbox. If a dir with tmp,new,cur, a Maildir. Probably MH otherwise. So provided you _make_ an empty Maildir (mkdir $d $d/tmp $d/new $d/cur) mutt will deliver into it correctly - no special modes. You only need to instruct mutt when _it_ creates the mail folder, by setting: set mbox_type=maildir as your preference for new folders. >> >I have to look into this some more. I am not sure if this is the standard way to store Maildir format messages. >> >> mutt doesn't care - there's no "standard". There was a recent discussion >> on mutt-users with another user moving to Maildir, who had nested >> folders. He's still got nested folders, exactly as before. Just don't >> name a subfolder like one of the three reserved names: "tmp", "new", >> "cur". >> >> So do it how you like it. > >Yes, that is what I would like: I do not have any subfolders with one of the three Maildir subfolders as a name. > >According to this post here: https://www.systoolsgroup.com/maildir/ the filename has this "gator3018.hostgator.com" which I presume comes from the hostname. How do I get this changed to something else (unique, but not to the hostname)? Is this where mutt or procmail is to be told to do this, how? Not sure. The hostname is, IIRC, an optional component for making the filesnames; I'm not sure mutt offers any control over that. Here're a couple of names from my main inbox: 1386376685.65689_1131.fleet:2,S 1602208593.#2087M806900P64256:2,S The former has a hostname in it, the latter does not. [looks...] Hoo, the one with a hostname is Very Old. Likely delivered by procmail and spamassassin. These days I collect with getmail and file with my own mail filer. The code for making a new Maildir folder in the latter is this: def newkey(self): ''' Allocate a new key. ''' now = time.time() secs = int(now) subsecs = now-secs key = '%d.#%dM%dP%d' % (secs, seq(), subsecs * 1e6, self.pid) assert self.validkey(key), "invalid new key: %s" % (key,) return key I believe once made, clients (mutt etc) don't muck with the names except to change the suffix (",S") which is where message flags are implemented (means you can set flags without editing the message file to fiddle a header). >> >One aspect of MH that I have liked is that I pull mail on two machines (using fetchmail via a POP server) and they are assigned the same filenames (numbers). Then, if I use rsync with delete, I can delete the corresponding message in the remote machine if I have deleted it on my local machine. It has worked like a charm over the past 15 years (I would say). >> >> Ah. This is a little trickier with Maildir, because message flags are >> stored in the filename. If you change the flags on both machines >> without an rsync in between you might run into trouble. With MH the >> flags are in the .mh-sequences file IIRC. You've still have an >> equivalent problem though - I presume you're excluding the .mh_sequences >> files from the rsync? > >So, sylpheed does not use or update the .mh_sequences but makes its own mark which is where it keeps all the information on the status of a message (read, replied, flagged, etc). I do send it up. > >> >> Is one of your machines considered the "main" machine where you read and >> maintain email, and the other a backup? Or do you delete at both ends? > > >The reason for how I set things up, and that has worked reasonably well, is (you sort of guessed it) that I read e-mail at work and home, but the work machine is the one that I consider to be reliably backed up. It is also bigger in terms of disk. So what happens is that I fetchmail with keep, process e-mail at work using sylpheed and then fire up my home machine (a laptop) and fetchmail with keep from the POP server and the rsync it down (including the .sylpheed_mark and .sylpheed_cache). Then I work on the home machine, continue to fetchmail process e-mails, etc with sylpheed and when I am done (before I hibernate), I rsync it all up before I go back to work, so that when I go to the other (work) machine, I have the same status as I left at home/work. It has worked reasonably well. Ah, so you've always got an rsync between transitions. That should work just as well with Maildir. I'm also aware of a number of people who remote to their main machine: ssh in and run mutt there. >Thanks, I have currently been using postfix too, but will probably try mutt's smtp (now that they have enabled office365 oauth2 support). Postfix has not yet done so, they have done some with gmail, but it is not completely clear to me yet how to use that with MS Office365. Same with msmtp, it seems. Fair enough. One advantage of postfix is that local programmes like cron can also send email. But of course, nothing prevents you having a working local postfix for the system and using mutt-smtp or one of the various "send with smtp" standalone tools as well. Cheers, Cameron Simpson <cs@xxxxxxxxxx> _______________________________________________ users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx