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

52 lines
1.2 KiB
Bash
Executable file

#!/bin/sh
#
# Nico Schottelius <nico@schottelius.(net|org)>
# Date: 22-Aug-2003
# Last Modified: 2004-08-22
# 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|^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
echo "Email=$email"
echo "Name=$name"
echo "Comment=$comment"
echo "Folder=$folder"
read -p "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