LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to configure Mutt to access /var/mail/ (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-configure-mutt-to-access-var-mail-4175555196/)

Duglas 10-03-2015 12:57 PM

How to configure Mutt to access /var/mail/
 
My email system is configured as follows:
fetchmail
procmail
mutt
msmtp

My mail is stored in ~/Mail/, and in Maildir format.

I want to configure Mutt to read local mail in /var/mail/<username>, which is in mbox format.

Alternatively redirect local mail to procmail to sort into ~/Mail/<subdirs>.

frankbell 10-03-2015 08:53 PM

You will need turn off fetchmail, then delete your present mail store (or at least rename the directory to take it out of circulaton), then edit .muttrc, .fetchmailrc, and .procmailrc to reflect the new configuration. Then turn fetchmail back on and test.

Note that, if you are using the mbox format, the mail does not go into subdirectories of the Mail director in your home directory. It goes into files (called "spoolfiles") in the Mail in your home directory, except for any mail that you choose to leave in the default mail directory of /var/spool/mail/[username].

This web page will provide far better guidance than I can, as it describes setting up an mbox style mailbox. http://docs.huihoo.com/gentoo/resour...e-to-mutt.html It was a primary resource when I set up Mutt for the first time.

I'll give you some sample lines from my .muttrc indicating where you should look to make your edits:

Code:

set mbox_type=Maildir
set spoolfile=~/Maildir/
set folder=~/Maildir/
set record="$HOME/Maildir/sent/"

In addition, any mailboxes configured in .muttrc will need to be edited appropriately.

In .procmailrc, you will need to edit the mailbox type. Again, some sample lines:

Code:

MAILDIR=$HOME/Maildir/
You will also need to change any recipes in .procmailrc to reflect the new configuration so that they point to the spool files, rather than to mail directories, as well as create the spoolfiles for any mailboxes you want in addition to the main one in /var/spool/mail/[username].

I did a podcast for Hacker Public Radio about setting up Mutt. You may find some of the links in the shownotes helpful.

(Two years ago, before I decided to Mutt, I wouldn't have understood a word of this.)

Duglas 10-04-2015 01:47 PM

Are you seriously suggesting that I rebuild my entire mail system to mbox, just to pick up /var/mail/<username>?

I had expected a suggestion on how to inject mail from /var/mail/ into the existing stream, so it would show up alongside mail from my ISP and Gmail etc.
Perhaps a bash script to read /var/mail/<username> and send the output to procmail, then delete /var/mail/<username>. However formating the mbox style mail file would be very difficult for me.

Another option is to just read /var/mail/<username> in vim, but I did want my local mail stored with my external mail.

goumba 10-04-2015 03:06 PM

Say what?

No need to delete your current mail store.
If I understand you correctly, you want the local mail to be treated the same as your foreign mail is treated... retrieve, process, put all in the same place. If this is what you want, check out https://wiki.debian.org/MaildirConfiguration

Do you just want to set up mutt easily to read the local mail from /var/spool/...? It will require a separate rc file, and you'll have to quit mutt to change between local and the delivered mail.

You can have either way, but not at the same time.

frankbell 10-04-2015 08:41 PM

Quote:

Are you seriously suggesting that I rebuild my entire mail system to mbox, just to pick up /var/mail/<username>?
If you want to switch your mailbox format, you must make the requisite changes. If you want to use /var/spool/mail, you use a spool file. That's how it works.

mbox and maildir are completely different formats. You can use one or the other with a single instance of Mutt, but you can't use both and you can't use a hybrid.

I've used both. I've switched from mbox to maildir and I've switched from maildir to mbox in the course of learning Mutt. Whichever format you choose, you must speak to it in a language it can understand.


All times are GMT -5. The time now is 07:37 AM.