Emails: the way I like it

Posted: August 31st, 2012 | Author: | Filed under: fun, productivity | Tags: , , , , , | No Comments »

Sharing my setup of text-based mail client for “efficient” emailing.

It consists of following 3 pieces

fetchmail – fetches incoming messages from SMTP/POP server
procmail – filters messages
msmtp – sends messages
mutt – mail client to view messages

~/fetchmailrc :

set logfile /tmp/fetchmail.log
poll protocol IMAP timeout 60
user "username"
pass "********"
fetchall ssl nokeep norewrite sslcertck sslcertpath /etc/ssl/certs
mda "/usr/local/bin/procmail -f %F -d %T";

~/procmailrc :

#Set on when debugging

#The directory where your mail folders will be stored.

# The log of procmail actions

#filtering rules
# any email sent to [email protected] will be stored in ~/mail/.hiren/ dir.

# similarly, you can have multiple rule...

# Catch-all rule for all unmatched email

For some weird reason procmail wanted me to name the dirs under ~/mail/ starting with a dot i.e. “.”

You can have your mail stored in mbox or maildir format. I like mailbox format as its more flexible. I am not going into details about that.
Please ask “the Internet” for the difference and detailed understanding.

I am using msmtp for sending emails.


logfile ~/.msmtp.log

account yourmail
from [email protected]
#auth on
user [email protected]
password *********

account default : yourmail

mutt related settings:

mutt is a very very powerful and customizable tool. I am listing only a few very basic setup settings for muttrc below:

set mbox_type=Maildir
set spoolfile="~/mail/"
set folder="~/mail/"
set mask="!^\\.[^.]"
set postponed="+.Drafts"
set imap_user=username

# The capcability settings
set mailcap_path=~/.mutt/mailcap

# Settings
source ~/.mutt/settings

# Mailbox definitions
source ~/.mutt/mailboxes-local

~/.mutt/settings is another very important file for basic settings:

set hostname=""
set tmpdir="~/.tmp"
set sort=threads
set sort_aux=last-date-received # showing threads with youngest message last
set sort_browser="reverse-date" # showing mbox list default to newest first
set reverse_alias # If there is an alias ... show that.
set quote_regexp="^([ \t]*[|>:%}#])+" # This is default.
set editor = "vim -u ~/.mutt/vimrc"
set abort_nosubject=yes # cancel messages w/o subject: line
set envelope_from=yes
mime_lookup application/octet-stream
alternative_order text/plain text/enriched text/html

set sendmail="/usr/local/bin/msmtp"
set hidden_host # mutt will skip the host name part of $hostname
set bounce_delivered # Postfix users may wish to unset this variable.
set abort_nosubject=no # don't abort compos. when no subj. is set
set quit=yes # just quit please, kthx
set postpone=ask-no
set delete=yes # delete messages marked for deletion w/o confirmation
set mark_old=no # don't change status of new messages to old
set move=no # don't move read messages

# IMAP settings
unset imap_passive
set imap_keepalive=300

# folder format
set folder_format="%2C %t %N %d %f"

~/.mutt/mailbox-local lists your dirs/folders setup for message filtering:

set folder="~/mail/"
set record="~/mail/.hiren"
mailboxes \
= \
=.hiren \
=.kernel \
=.freebsd \
=.random # note: the last line does not end with backslash

Disclaimer: I’ve just shown basic settings here. Let me know if you are looking for any specific info.