News | About | Get Frugalware | Packages | Documentation | Discussion Forums | Bug Tracker | Wiki | Community | Development

Mutt-ng

From FrugalWiki

Jump to: navigation, search

Contents

Introduction

Recently I had to set up my muttng to use multiple IMAP servers. I saw now automated way to get the folder list, so I've written a small Python script to handle this functionality. Later then I was asked to put this all to this wiki page.

So here is my whole muttng config. As far as I know it should work with mutt-devel, too (except the sidebar settings).

Installation

sudo pacman -S mutt-ng

will install the newest muttng snapshot for you.

Basic configuration

The main configuration file is located at

~/.muttng/muttngrc

You can reach my muttngrc here.

A few notes to it:

source 'cat ~/.muttng/accounts/*|'

This will include the configurations of all accounts, see later.

There are lists to where I sometimes post, then I wait for the answer and finally I don't care the traffic of the list for a half or year. So I've created two macros to hide (default) / show them:

macro index P "<enter-command>unmailboxes `sh ~/.muttng/biglists.sh`<enter>"
macro index L "<enter-command>mailboxes `sh ~/.muttng/biglists.sh`<enter>"

I use bogofilter to filter spams and I have two macros to finetune it:

macro index S "<enter-command>unset wait_key\n\
<pipe-entry>bogofilter -Ns;date +%y%m%d >>~/public_html/stats/spam_s\n\
<enter-command>set wait_key\n\
<delete-message>"
macro index H "<enter-command>unset wait_key\n\
<pipe-entry>bogofilter -Sn\n\
<enter-command>set wait_key\n"

To set up GPG, I've copied the config template from the muttng package:

cp /usr/share/doc/mutt-ng-*/samples/gpg.rc ~/.muttng/

Then I've added the followings to the end of my muttrc:

source ~/.muttng/gpg.rc
unset crypt_autosign
unset crypt_autoencrypt
set crypt_replysign
set crypt_replyencrypt
set crypt_verify_sig=yes
set pgp_sign_as="0x03915096"

Finally you may notice the 3 magic "source" command to include the rest of the config files:

source ~/.muttng/aliases
source ~/.muttng/lists
source ~/.muttng/colors

Handling mailing lists

The 'lists' file contains a list of mailing lists to where I'm subscribed, so that I can make use of the 'reply' and 'reply to list' functions:

subscribe frugalware-darcs
subscribe frugalware-devel
subscribe frugalware-users
subscribe frugalware-bugs
subscribe darcs-users
subscribe pacman-std-devel
subscribe openoffice@lists.ximian.com
# vim: ft=muttrc

Colors

I not an artwork genius, so I've just copied "Joe's Mutt 1.4 Config (http://blue.frogfoot.net/)" to the 'colors' file.

Aliases

In the aliases file in every line I define a new alias, one example should make the syntax clear:

alias fw-dev List for Frugalware developers <frugalware-devel@frugalware.org>

Accounts

Filesystem

I try to forward the mails from all my addresses to one central address and I have physical access to those mails. Also I'm working for a company and I don't want to redirect those mails to my personal address.

So here is the config for my personal account (~/.muttng/10localhost):

set folder=~/Maildir/
mailboxes `echo -n ~/Maildir/" "; find ~/Maildir/ -maxdepth 1  -type d  -regex '.*\..*'|sort|tr '\n' ' '`
unmailboxes `sh ~/.muttng/biglists.sh`
folder-hook ~/Maildir 'set folder=~/Maildir/ record=+.Sent postponed=+.Unsent from="VMiklos <vmiklos@frugalware.org>"'
folder-hook ~/Maildir set signature=~/.muttng/signatures/frugalware

Basically I add the contents of my physical ~/Maildir directory. You can see that the list of mailboxes is autogenerated by a hackish 'find' command. Also there is that biglists.sh to blacklist a few folders:

echo -n ~/Maildir/.Lists.{\
list1,\
list2,\
list3}
echo " `find ~/Maildir -maxdepth 1 -name '.People.Old.*'|sed -e :a -e '$!N;s/\n/ /;ta' -e 'P;D'`"

This blacklists .Lists.list{1,2,3} and .People.Old.* (notice that nice sed command at the end of the last line :) ).

Also I've defined hooks to set the proper email address, signature and sent/unsent folders for this account.

Imap via tunnel

Here is the contents of ~/.muttng/accounts/50tunnel:

set folder="imaps://vmiklos@tunnel.com"
account-hook imaps://vmiklos@tunnel.com/ 'set tunnel="ssh -q tunnel.com /usr/sbin/imapd"'
folder-hook imaps://vmiklos@tunnel.com/ 'set folder=imaps://vmiklos@tunnel.com/ record=+mail/Sent postponed=+mail/Unsent from="Miklos Vajna <vmiklos@dsd.sztaki.hu>" signature=~/.muttng/signatures/private'
mailboxes `python ~/.muttng/list.py mail "ssh -q tunnel.com /usr/sbin/imapd"`

As you can see I've only set the tunnel directive but I've defined no password. This is because I'm using the keychain tool and ssh keys to reach that server.

set set folder line allows me to use the + sign in the folder-hook line. The list of mailboxes is autogenerated again, but this time I've written a small python script to fetch the list of mailboxes, you can reach it here.

The real imap server

The third server I'm using is a normal imaps server without any tunneling.

The contents of ~/.muttng/accounts/90imap:

set folder="imaps://imapserver.com"
account-hook imaps://imapserver.com/ 'set imap_user=vmiklos@imapserver.com imap_pass=password'
folder-hook imaps://imapserver.com/ 'set folder=imaps://imapserver.com/ record=+Sent postponed=+Unsent from="VMiklos <vmiklos@imapserver.com>"'
mailboxes `python ~/.muttng/list.py imapserver.com vmiklos@imapserver.com password ""`

This time the password is store here plaintext, so be sure to 'chmod 600' this file after you've customized it.

I hope I've described all the tricks I'm using ;-)

External links

Personal tools
Namespaces
Variants
Actions