nsbin/add-mutt+procmail-autosort-2004-04-29
Nico Schottelius d3c6e29902 Initial commit
2006-07-20 09:54:37 +02:00

49 lines
1.2 KiB
Bash

#!/bin/sh
#
# Nico Schottelius <nico@schottelius.(net|org)>
# Date: 22-Aug-2003
# Last Modified: 29-Apr-2004
# Add mutt hooks and procmail entries at the same time
# Please use a 'DEFAULT' entry in procmailrc to make it work
#
PROCMAILRC=~/.procmailrc
MUTT_MAILBOXES=~/.mutt/mailboxes
MUTT_HEADERS=~/.mutt/hooks
#PROCMAIL_MATCH="^TO" # email after that
PROCMAIL_MATCH="^Delivered-To: " # email after that
echo generating new mutt and new procmailentry
read -p "To Email: " email
read -p "To which folder: " folder
read -p "Your name: " name
read -p "Comment: " comment
read -p "Email=$email, name=$name, comment=$comment and folder=$folder. Enter to continue" bla
# procmail: insert at first line
cat << EOF >> $PROCMAILRC
### autogenerated by add-mutt+procmail-autosort ($comment)
:0
* $PROCMAIL_MATCH$email
$folder/
EOF
# mutt/checking
cat << EOF >> $MUTT_MAILBOXES
### for $email / $name / $comment
mailboxes +$folder/
EOF
# mutt/headers
cat << EOF >> $MUTT_HEADERS
# $comment
folder-hook $folder 'my_hdr From: $name <$email>'
folder-hook $folder 'set from="$email"'
EOF
# folder; {new,cur,tmp} does not work in ash
mkdir -p ~/Maildir/$folder/new
mkdir -p ~/Maildir/$folder/cur
mkdir -p ~/Maildir/$folder/tmp