fetchmail, procmail, mutt
gm5729
gm5729 at gmail.com
Wed Apr 21 13:20:22 MST 2010
> Message: 6
> Date: Wed, 21 Apr 2010 00:04:56 -0700 (MST)
> From: Robert Holtzman <holtzm at cox.net>
> Subject: Re: fetchmail, procmail, mutt
> To: Main PLUG discussion list <plug-discuss at lists.plug.phoenix.az.us>
> Message-ID: <alpine.DEB.2.00.1004202343460.31213 at localhost>
> Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
>
> On Tue, 20 Apr 2010, Matthew Coulliette wrote:
>
>> Hi everyone,
>>
>> I am trying to setup fetchmail to get my email from the server, procmail to
>> sort my email, and mutt to read my email. So far, fetchmail appears to work.
>> It gets the mail and puts it in /var/mail/username. I believe that the next
>> step is to have procmail sort it into mailboxes. I have created a .mail dir
>> in my home dir. I attached a copy of the .procmailrc file that I have
>> written. It does not appear to work. Can someone tell me what is wrong with
>> the config file. Any other comments or suggestions are also welcome.
>
> My .fetchmailrc file looks like this:
>
> poll "pop.west.cox.net"
> protocol pop3
> username "xxxxxx"
> password "xxxxxxxxxx"
> mimedecode
> mda "/usr/bin/procmail -f -"
>
>
> Note the call to procmail. You didn't say which mailbox format you
> wanted. This will deliver mail in mbox format. If you want the maildir
> format the URL in the other reply might be what you want. Don't know.
> There are advantages and disadvantages to both formats.
>
> In your .procmailrc file MAILDIR=/home/matthewmpp/.mail doesn't work. I
> learned that the hard way. It will always revert to the default mailbox.
> You had it right with DEFAULT=/home/matthewmpp/.mail/all. Is there a
> reason you got away from that? The relevant part of my >procmailrc file
> is:
>
> #MAILDIR=/var/mail
> #MAILDIR=/var/spool/mail
> DEFAULT=$HOME/mail/INCOMING <========
>
> --
> Bob Holtzman
> Key ID: 8D549279
> "If you think you're getting free lunch,
> check the price of the beer"
Oh boy these are all fun to setup... :) I run fetchmail, procmail,
mutt and msmtp. In my ~ there is a ~/.mutt/ which contains all my
formatting. In my ~ there is also a folder ~/.MuttMail which contains
all my mailboxes. MBox was easier as was pop3 for me than Maildir and
Imap. Do note with MBox you MUST have /tmp /curr and /new directory in
your ~/.MuttMail folder
cat .fetchmailrc
poll pop.gmail.com protocol pop3 user "XXXXXXX"
cat .procmailrc
PATH=/bin;/usr/bin;/usr/local/bin
MAILDIR=$HOME/.MuttMail ##you better make sure it exists
DEFAULT=$MAILDIR/INBOX
LOGFILE=$MAILDIR/.procmail_log
LOGABSTRACT=no
VERBOSE=on ##only used for debugging
FORMAIL=/usr/bin/formail
NL=' '
##recipe lines begin with :0
##dont put comments on recipe lines
##disable a recipe with the false condition!
##condition lines begin with * and regex is your friend
##conditions are anded and everything after * is fed straight into
#####egrep
##one action line follows the conditions, in this case it is a
#####mailbox name
#
#
#
#catch duplicates using formail
#:0 Whc:.msgid.lock
#|$FORMAIL -D 16384 .msgid.cache
#:0
#$MAILDIR/duplicates
#now flush spam out
:0
*^Subject:.*(credit|cash|money|debt|sex|sale|loan)
$MAILDIR/spam
#no more html messages
:0
*^Content-Type:.*html
$MAILDIR/junk
#now put my mail lists into mailboxes
:0
*^List-Id:.*wftl-lug
$MAILDIR/wftl-lug
:0
*^List-Id:.* plug-discuss
$MAILDIR/plug-discuss
:0
*^List-Id:.*arch-linux
$MAILDIR/arch-linux
:0
*^List-Id:. *nlug-talk
$MAILDIR/nlug-talk
:0
*^List-Id:. *tclug
$MAILDIR/tclug
################################
# Last Rule: Hamm
#
:0
*.*
$DEFAULT
#EOF
#
cat .muttrc
# vim:syn=muttrc
# auto login to this mailbox at startup
#Vim Settings for interfacing with Mutt
set editor='vim -c "set tw=72" '
###
# ~/.muttrc
#
# *updated --again-- to remove options that simply duplicate defaults*
#
###
# directories and commands
set move=yes
source /etc/Muttrc.gpg.dist
source /$HOME/.mutt/gpg
set sendmail="/usr/bin/msmtp"
set query_command = "/$HOME/.abook/addressbook '%s' " #
alias file with abook
set alias_file = /$HOME/.MuttMail/alias #alias file
# set certificate_file = ~/.mutt/certificates #
where to store certs
set header_cache = /$HOME/.MuttMail/headers #
where to store headers
set message_cachedir = /$HOME/.MuttMail/cache/bodies #
where to store bodies
set mailcap_path = /$HOME/.MuttMail/mailcap #
entrys for filetypes
set signature = /$HOME/.mutt/signature # my
signature file
set tmpdir = /$HOME/.MuttMail/tmp #
where to keep temp files
set ispell = "aspell -e -c" # use
aspell as ispell
# set query_command = "mutt_vc_query '%s'" #
query rolo's vCards
set print_command = "enscript -p - | psselect -r | lp" #
print email in reverse page order
# maildir settings
set mbox_type = Maildir # mailbox type
set folder =/$HOME/.MuttMail # mailbox location
set spoolfile =+GMail/INBOX # GMail
is default inbox
set record =/$HOME/.MuttMail/sent
# main options
unset confirmappend #
don't ask, just do
set delete #
don't ask, just do
set mail_check = 0 #
minimum time between scans
unset markers # no
ugly plus signs
unset mark_old #
read/new is good enough for me
set menu_scroll #
scroll in menus
set pager_index_lines = 10 #
number of index lines to show
set pager_context = 5 #
number of context lines to show
set pager_stop #
don't go to next message automatically
set pipe_decode #
strip headers and eval mimes when piping
set reverse_alias #
show names from alias file in index
set sort = threads # like gmail
set sort_aux = reverse-last-date-received # like gmail
unset sort_re #
always thread
set thorough_search #
strip headers and eval mimes before searching
set tilde #
show tildes like in vim
set timeout = 3 #
idle time before scanning
# enriched messages
alternative_order text/richtext text/enriched text/html # but save
it for last
# formats and regexps
set alias_format = "%4n %t %-20a %r"
set date_format = "%m/%d/%y at %I:%M%P"
set index_format = "%3C %Z %[!%m/%d] %-17.17F %s"
set quote_regexp = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"
set reply_regexp = "^(([Rr][Ee]?(\[[0-9]+\])?: *)?(\[[^]]+\] *)?)*"
set status_format = "-%r- %v ─┴────/ %f %m%?n? [+%n]?%?d?
[-%d]?%?t? [*%t]? /%?p?───/ %p waiting to send /?─%>─(%P)───"
push <show-version>
# composing mail
set askcc # ask for CC:
set askbcc
set attribution = "On %d, %n wrote:" #
set the attribution
set edit_headers #
show headers when composing
set fast_reply #
skip to compose when replying
set forward_format = "Fwd: %s" #
format for subject when forwarding
set forward_quote #
include message in forwards
set include #
include message in replies
# headers to show
ignore * #
ignore all headers
unignore from: to: cc: bcc: date: subject: #
show only these
hdr_order from: to: cc: bcc: date: subject: #
and in this order
# lists and boxes
subscribe plug-discuss wftl-lug nlug-talk tclug
mailboxes +GMail/INBOX +GMail/archive +GMail/sent +GMail/drafts +GMail/trash
# conditionally source a 256 colors file
source `FILE=$HOME/.mutt/colors.muttrc; [[ $TERM =~ 256 ]] &&
FILE=$HOME/.mutt/256colors.muttrc; echo $FILE`
# conditionally source sidebar options
#source `FILE=$HOME/.mutt/sidebar.muttrc; mutt -v | grep -q sidebar ||
FILE=/dev/null; echo $FILE`
# these are always sourced
source $alias_file #
required for functionality
source $HOME/.mutt/gmail.muttrc
# source gmail as default
# override with account specific folder-hooks
folder-hook GMail/* source $HOME/.mutt/gmail.muttrc
# alternate "me"s
set realname=XX
set from=XXXXXXX at gmail.com
my_hdr From: XXX <XXXXXX at gmail.com>
# these just give me headaches
#bind index,pager \# noop
#bind index,pager \& noop
#bind index i noop
# bindings - very vim-like
bind pager i exit
bind pager q toggle-quoted
bind pager / search
bind pager <up> previous-line
bind pager <down> next-line
bind pager k previous-line
bind pager j next-line
bind pager gg top
bind pager G bottom
bind index gg first-entry
bind index G last-entry
bind pager K previous-undeleted
bind pager J next-undeleted
bind index K previous-unread
bind index J next-unread
bind pager l view-attachments
bind index l display-message
bind browser l select-entry
bind attach l view-attach
bind index,pager R group-reply
bind attach,browser h exit
# cc myself when replying to an ML
# note: with this, you can't :q! mid-compose to abort
# instead, just :wq and abort from the compose menu
unhook send-hook
send-hook "~u" "push '<edit-cc>XXXXX\@gmail.com<enter>'"
#Macros/HotKeys
macro index h "c?" "view folders"
##macro index \Cr
"<tag-pattern>~u<enter><tag-prefix><clear-flag>N<untag-pattern>all<enter><sync-mailbox>"
"mark all subscribed ##lists as read"
#macro index B "<limit>~b " "search message bodies"
#macro index I "<change-folder>!<enter>" "go to Inbox"
#macro index P "<pipe-message>cat > ~/" "save message as"
#For empty mailboxes
macro pager "y" "<change-folder>?<toggle-mailboxes>"
macro index "y" "<change-folder>?<toggle-mailboxes>"
#bind pager h display-toggle-weed #toggle headers with h key
#simulate the old url menu
macro index \cb |urlview\n'call urlview to extract URLs out of message'
macro pager \cb |urlview\n'call urlview to extract URLs out of message'
#run fetchmail by hitting the key of G
macro index G '<shell-escape>fetchmail --port 995 --ssl -kva -m
"/usr/bin/procmail -d %T"'
macro pager G '<shell-escape>fetchmail --port 995 --ssl -kva -m
"/usr/bin/procmail -d %T"'
#set print_command="/usr/bin/muttprint %s -p {http://192.168.1.110:9100}"
#GNUPG#
set pgp_decode_command="/usr/bin/gpg %?p?--passphrase-fd 0?
--no-verbose --batch --output - %f"
set pgp_verify_command="/usr/bin/gpg --no-verbose --batch --output -
--verify %s %f"
set pgp_decrypt_command="/usr/bin/gpg --passphrase-fd 0 --no-verbose
--batch --output - %f"
set pgp_sign_command="/usr/bin/gpg --no-verbose --batch --output -
--passphrase-fd 0 --armor --detach-sign --textmode %?a?-u %a? %f"
#set pgp_clearsign_command="/usr/bin/gpg --no-verbose --batch --output
- --passphrase-fd 0 --armor --textmode --clearsign %?a?-u %a? %f"
set pgp_encrypt_only_command="pgpewrap /usr/bin/gpg --batch --quiet
--no-verbose --output - --encrypt --textmode --armor --always-trust
--encrypt-to D537A8E1 -- -r %r -- %f"
set pgp_encrypt_sign_command="pgpewrap /usr/bin/gpg --passphrase-fd 0
--batch --quiet --no-verbose --textmode --output - --encrypt --sign
%?a?-u %a? --armor --always-trust --encrypt-to XXXXXXXXXXX -- -r %r --
%f"
set pgp_import_command="/usr/bin/gpg --no-verbose --import -v %f"
set pgp_export_command="/usr/bin/gpg --no-verbose --export --armor %r"
set pgp_verify_key_command="/usr/bin/gpg --no-verbose --batch
--fingerprint --check-sigs %r"
set pgp_list_pubring_command="/usr/bin/gpg --no-verbose --batch
--with-colons --list-keys %r"
set pgp_list_secring_command="/usr/bin/gpg --no-verbose --batch
--with-colons --list-secret-keys %r"
set pgp_autosign=yes
set pgp_sign_as=XXXXXXXXXXXX
set pgp_autoencrypt=no
set pgp_replyencrypt=yes
set pgp_timeout=30
set pgp_good_sign="^gpg: Good signature from"
set crypt_autosign=no
cat .msmtprc
account gmail
host smtp.gmail.com
port 587
from gm5729 at gmail.com
tls_starttls on
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
auth on
user XXXX at gmail.com
password XXXXXXXXX
logfile ~/.msmtp.log
This is a working example.
VampirePenguin
More information about the PLUG-discuss
mailing list