Eric Day

Thoughts, code, and other oddments.
Dark | Light

Notes - Linux

Mail Configuration Files

I grab my mail using fetchmail, which then passes each message off to procmail to put in the correct folder. I use mutt as my MUA, and then esmtp to send mails from mutt. I also have aspell bound to CTRL-L in vim for spell checking. My hosting provider does spam filtering by inserting 'JunkMail' into the Subject header, so procmail looks for that. Here are the configuration files for each:

.muttrc

set write_inc=500
set read_inc=500
set pager_index_lines=6
set sendmail="/usr/bin/esmtp"
set envelope_from=yes

# aliases
alias john john@smith.com

# various preferences
set realname="Eric Day"
set hostname=work.com
set editor=/usr/bin/vi
set from=eday@work.com
folder-hook personal set from=eday@personal.com

# mailboxes
set folder=/home/eday/mail
set record=+sent
set mbox=+work
set spoolfile=+work
mailboxes +work +driz +personal

auto_view text/html

# colors
# white, black, green, magenta, blue, cyan, yellow, red, default, colorN.
color attachment yellow        default
#color body       magenta       default      "a"
color bold       brightmagenta default
color error      red           default
color hdrdefault blue          default
color header     red           default      "^from: "
color header     red           default      "^reply-to: "
color header     yellow        default      "^subject: "
color header     red           default      "^to: "
color header     red           default      "^cc: "
color indicator  default       red 
color index      yellow        default      "~N" # new messages
color index      yellow        default      "~U" # unread messages
color index      red           default      "~F" # flagged messages
#color index      cyan          default      "~Q" # messages replied toto
#color index      magenta       default      "~G" # pgp encrypted messages
#color index      green         default      "~g" # pgp signed message
color index      blue          default      "~D" # deleted messages
color markers    default       default
color message    default       default
color normal     default       default
color quoted     green         default
color quoted1    cyan          default
color quoted2    blue          default
color search     brightmagenta default
color signature  cyan          default
color status     red           default
color tilde      brightmagenta default
color tree       red           default
color underline  brightmagenta default

.fetchmailrc

poll mail.work.com protocol pop3:
    user eday@work.com there with password SECRET is eday here
    mda "/usr/bin/procmail -d %T"

poll mail.personal.com protocol pop3:
    user eday@personal.com there with password SECRET is eday here
    mda "/usr/bin/procmail -d %T"

.procmailrc

HOME=/home/eday
MAILDIR=$HOME/mail
DEFAULT=$MAILDIR/work
LOGFILE=$HOME/.procmail.log
LOCKFILE=$HOME/.procmail.lock

:0:
* ^Subject:.*JunkMail
junk

:0:
* (^TO|^From.*|^Subject:.*|^X-Launchpad-Message-Rationale:.*)drizzle
driz

:0:
* ^TOpersonal.com
personal

# couldn't filter, put into DEFAULT

.esmtprc

identity = eday@work.com
    hostname = mail.work.com:25
    username = "eday@work.com"
    password = "SECRET"
    starttls = required

identity = eday@personal.com
    hostname = mail.personal.com:25
    username = "eday@personal.com"
    password = "SECRET"
    starttls = required

.vimrc

set cpo-=<
map ^L :w<CR>:!aspell -c %<CR>:e! %<CR>
map ^K !} fmt -72<CR>

The ^L and ^K for the .vimrc are CTRL-V CTRL-L (or K), it is not actually the '^' character. This allows you to press CTRL-L to run aspell and spell check your message, or press CTRL-K to reformat a paragraph to be 72 characters wide.

To begin getting messages, I run:

fetchmail --ssl -k -U -d 60

This starts fetchmail as a daemon and keeps messages on the server. Right after running a backup, I kill the background fetchmail and run:

fetchmail --ssl -F -U

This will remove all messages from the server, so if you have to restore from backup and start pulling messages again, you only pull the ones since the last backup (not all previous that have been saved on the server). This keeps the space being used on your mail server small as well, assuming of course you backup regularly!

Blog
Wiki
About
Resume
RSS
Comments

E-Mail
Launchpad
LinkedIn
Twitter
identi.ca
Facebook

OpenStack
Scale Stack
Gearman
NW Veg
Veg Food & Fit

Linux On Laptops