January 16, 2008 Archives

Wed Jan 16 19:23:44 IST 2008

Email setup

I recently switched from using Thunderbird to mutt as my mail client. While making that jump, I also made the switch from mbox to maildir as my email storage format (Thunderbird only supports mbox, mutt supports both), with the help of mb2md.

Here's my .muttrc :
# -*-muttrc-*-
#


set realname="Devendra Gera" set from=gera@example.com # my real email goes here

set mark_old=no # unread messages remain as "new" set mbox_type=Maildir # Mbox kinda sucks set folder="/home/gera/Mail" # the mail system resides here set mask="!^\\.[^.]" # I don't want to see the current dir alias '.' I do want to see '..' set mbox="/home/gera/Mail/" # my mailbox set record="+.Sent" # a copy of sent messages is kept here set postponed="+.Drafts" set spoolfile="=.Inbox" # mutt starts in this folder set tmpdir="/home/gera/.mutt-tmp" # my $HOME is encrypted. I want mutt to remain in that

# set up mailboxes by scanning all subfolders in mail dir mailboxes `echo -n "+ "; find /home/gera/Mail -type d -name ".*" -printf "+'%f' "`

# some useful macros macro index c "?" "open a different folder" macro pager c "?" "open a different folder" macro index C "?" "copy a message to a mailbox" macro index M "?" "move a message to a mailbox" macro compose A "?" "attach message(s) to this message"

set delete=yes # delete at exit set strict_threads # only a subject match not sufficient for including in a thread set index_format="%2C %Z %{%b %d} %-15.15n %-.58s %> %c" # status line for index views

# How to process file completion using ^T set query_command="lbdbq %s" # I rerely if ever use this. Instead, my alias file is auto updated

# editing outgoing mail set editor="vim +':set spell' +/^Subject: ++0" # use vim with spellcheck and position at the subject line set autoedit # jump to the editor directly set edit_headers # allows me to change/see headers set reply_to # uses reply-to: header set copy=yes # preserve a copy of outgoing mail set attribution='On %{%a, %d %b %Y}, %n wrote:\n' # attribution for replies set forward_format="Fw: [%s]" # for forwards unset reply_self # do not include myself in group replies

# headers - choose the ones I like to see ignore * unignore from date subject to cc reply-to X-Mailer User-Agent unignore x-mailing-list: hdr_order From: Reply-To: To: CC: Date: Subject:

# outgoing mail set sendmail_wait=0 # wait indefinitely for 'sendmail' set sendmail="/home/gera/bin/msmtp_helper" # I use msmtp, but this wrapper auto edits my .aliases set realname="Devendra Gera" set use_from=yes # this is used to select the smtp server/account set envelope_from=yes

# the real domains and CompanyName are masked in the following macro generic "1" ":set from=gera@example.com" macro generic "2" ":set from=gera@example2.com" macro generic "3" ":set from=gera@example3.net" folder-hook =.Inbox set from=gera@example.com folder-hook =.Inbox set pgp_sign_as="0x0F4D93D7" folder-hook =.SiteEmail set from=gera@example3.net folder-hook =.SiteEmail set pgp_sign_as="0xF258D82F" folder-hook =.CompanyName* set from=gera@example2.com folder-hook =.CompanyName* set pgp_sign_as="0x85377D1B" folder-hook =.work* set from=gera@example2.com folder-hook =.work* set pgp_sign_as="0x85377D1B"

# misc set check_new # check new msgs set fast_reply # yeah baby! set tilde # I like the vim-ish view set include # include msg in replies set noconfirmappend # I'm not sure if it does anything for maildir set menu_scroll # scroll menus instead of paginate set mime_forward=ask-no # inline forwarding by default, unless I say no set move=no # I want to move messages myself set beep_new=no set help=yes set print_command="muttprint" set ispell="aspell -e -c" # aspell knows how to check emails set pager_context=1 # one line of context works well for me set pager_index_lines=9 # view a "folder pane" when reading messages set sort=threads # threaded sort auto_view text/html # see mailcap for html mails. html mails are dumped by # lynx into the tmp dir which I specify to be in my $HOME alternative_order text/plain text text/enriched # try to display plain text if possible set alias_file=~/.aliases # this is auto controlled by my msmtp helper set sort_alias=alias # sort aliases in alias order set reverse_alias=yes # display aliases on incoming email source $alias_file set auto_tag=yes # any operations are apllied to tagged msgs, if any.

# status line formats set status_format="-%r-Mutt: %f [Msgs:%?M?%M/?%m%?n? New:%n?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b? %l]---(%s)-%>-(%P)---" set pager_format="%-10.10i %[!%a %b %d %R]" set date_format="!%H:%M %a %d %b " set index_format="%4C %Z %X %[%b%d] %-15.15F %M %s" set folder_format="%2C %t %8s %d %N %f"

set crypt_autopgp=yes # enable pgp/signing set crypt_autosign=yes # always sign set crypt_replyencrypt=yes # reply to sectrets in secrets set crypt_replysignencrypted=yes # always sign set pgp_show_unusable=no # don't show unusable keys

#### The following comes straight out of the default.

# Note that we explicitly set the comment armor header since GnuPG, when used # in some localiaztion environments, generates 8bit data in that header, thereby # breaking PGP/MIME.

# decode application/pgp set pgp_decode_command="/usr/bin/gpg --status-fd=2 %?p?--passphrase-fd 0? --no-verbose --quiet --batch --output - %f"

# verify a pgp/mime signature set pgp_verify_command="/usr/bin/gpg --status-fd=2 --no-verbose --quiet --batch --output - --verify %s %f"

# decrypt a pgp/mime attachment set pgp_decrypt_command="/usr/bin/gpg --status-fd=2 %?p?--passphrase-fd 0? --no-verbose --quiet --batch --output - %f"

# create a pgp/mime signed attachment # set pgp_sign_command="/usr/bin/gpg-2comp --comment '' --no-verbose --batch --output - --passphrase-fd 0 --armor --detach-sign --textmode %?a?-u %a? %f" set pgp_sign_command="/usr/bin/gpg --use-agent --no-verbose --batch --quiet --output - %?p?--passphrase-fd 0? --armor --detach-sign --textmode %?a?-u %a? %f"

# create a application/pgp signed (old-style) message # set pgp_clearsign_command="/usr/bin/gpg-2comp --comment '' --no-verbose --batch --output - --passphrase-fd 0 --armor --textmode --clearsign %?a?-u %a? %f" set pgp_clearsign_command="/usr/bin/gpg --use-agent --no-verbose --batch --quiet --output - %?p?--passphrase-fd 0? --armor --textmode --clearsign %?a?-u %a? %f"

# create a pgp/mime encrypted attachment # set pgp_encrypt_only_command="pgpewrap gpg-2comp -v --batch --output - --encrypt --textmode --armor --always-trust -- -r %r -- %f" set pgp_encrypt_only_command="pgpewrap /usr/bin/gpg --batch --quiet --no-verbose --output - --encrypt --textmode --armor --always-trust -- -r %r -- %f"

# create a pgp/mime encrypted and signed attachment # set pgp_encrypt_sign_command="pgpewrap gpg-2comp --passphrase-fd 0 -v --batch --output - --encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r -- %f" set pgp_encrypt_sign_command="pgpewrap /usr/bin/gpg %?p?--passphrase-fd 0? --batch --quiet --no-verbose --textmode --output - --encrypt --sign %?a?-u %a? --armor --always-trust -- -r %r -- %f"

# import a key into the public key ring set pgp_import_command="/usr/bin/gpg --no-verbose --import %f"

# export a key from the public key ring set pgp_export_command="/usr/bin/gpg --no-verbose --export --armor %r"

# verify a key set pgp_verify_key_command="/usr/bin/gpg --verbose --batch --fingerprint --check-sigs %r"

# read in the public key ring set pgp_list_pubring_command="/usr/bin/gpg --no-verbose --batch --quiet --with-colons --list-keys %r"

# read in the secret key ring set pgp_list_secring_command="/usr/bin/gpg --no-verbose --batch --quiet --with-colons --list-secret-keys %r"

# fetch keys # set pgp_getkeys_command="pkspxycwrap %r" # This will work when #172960 will be fixed upstream # set pgp_getkeys_command="/usr/bin/gpg --recv-keys %r"

# pattern for good signature - may need to be adapted to locale!

# set pgp_good_sign="^gpg: Good signature from"

# OK, here's a version which uses gnupg's message catalog: # set pgp_good_sign="`gettext -d gnupg -s 'Good signature from "' | tr -d '"'`"

# This version uses --status-fd messages set pgp_good_sign="^\\[GNUPG:\\] GOODSIG"


I use fetchmail for getting my email, and msmtp to send it out.

I wrote a simple wrapper around msmtp, which adds addresses from the To: and Cc: fields to my .aliases, if they're already not there. I'll post that subsequently.

Posted by gera | Permanent Link | Categories: tricks | [ 1 ]